From 6da3aaaa36f61fda616ed217ce1e6084e1cd5eb3 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Wed, 12 Jun 2013 18:01:16 +0000 Subject: [PATCH] Added total for used modules and users to the module statistics. --- module_stats.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module_stats.py b/module_stats.py index fcaee95..5bd8eac 100755 --- a/module_stats.py +++ b/module_stats.py @@ -11,6 +11,8 @@ from optparse import OptionParser modules = list() modulestats = dict() moduleusers = dict() +total_modules = 0 +total_users = set() logdir = '/sw/laki/hlrs/system/modules/logs/' enddate = datetime.date.today() @@ -50,6 +52,8 @@ for logfilename in os.listdir(logdir) : user = line.split()[-3][5:] # remove user: in front if options.nohpc and 'hpc' in user : continue + total_users.add(user) + total_modules = total_modules + 1 if module not in modules: modules.append(module) modulestats[module] = 1 @@ -73,4 +77,7 @@ print "-"*78 for (v,m) in sorted( ((v,k) for k,v in modulestats.iteritems()), reverse=True) : print "{0:60s}{1:>8d} {2:>8d}".format(m, v, len(moduleusers[m].keys())) #print moduleusers[m] - +print "-"*78 +print "{0:60s}{1:>8d} {2:>8d}".format('total', total_modules, len(total_users)) +#print sorted([ (u) for u in total_users ]) +print "-"*78