/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/jplist/jplist
ViewVC logotype

Contents of /trunk/nl.nikhef.ndpf.tools/jplist/jplist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2547 - (show annotations) (download)
Sat Apr 28 11:37:04 2012 UTC (9 years, 8 months ago) by templon
File size: 1505 byte(s)
change formatting again

1 #!/usr/bin/env python
2
3 # $Id$
4 # Source: $URL$
5 # J. A. Templon, NIKHEF/PDP 2010
6
7 import os
8 import sys
9
10 # indices for qstat
11 JID=0
12 NAM=1
13 POOLU=2
14 TSTR=3
15 STAT=4
16 QNAM=5
17
18 # indices for diagnose -p
19 # JID zero here too
20 SCHEDRANK=1
21 PRIO=2
22 FS=3
23
24 import commands
25
26 statp, outp = commands.getstatusoutput('qstat')
27 statp2, outp2 = commands.getstatusoutput('diagnose -p')
28
29 lines = outp.split('\n')[2:]
30
31 jud = dict()
32 sd = dict()
33
34 for line in lines:
35 flds = line.split()
36 usr = flds[POOLU]
37 if usr not in sd:
38 sd[usr] = {'Q' : 0, 'R' : 0, 'other' : 0}
39 if flds[STAT] in ['R', 'Q']:
40 sd[usr][flds[STAT]] += 1
41 else:
42 sd[usr]['other'] += 1
43 jidstr = flds[JID]
44 endindex = jidstr.find('.stro')
45 jidnum = jidstr[:endindex]
46 jud[jidnum] = usr
47
48 lines = outp2.split('\n')[5:]
49
50 jpd = dict()
51 for line in lines:
52 if line == '': break
53 flds = line.split()
54 jid = flds[JID]
55 rank = flds[SCHEDRANK]
56 if jid in jud.keys():
57 usr = jud[jid]
58 if rank not in jpd.keys():
59 jpd[rank] = dict()
60 if usr not in jpd[rank].keys():
61 jpd[rank][usr] = list()
62 jpd[rank][usr].append(jid)
63
64 plist = jpd.keys()
65 plistnumeric = list()
66 for k in plist:
67 plistnumeric.append(int(k))
68 plistnumeric.sort(reverse=True)
69
70 print "Sched.rank User Waiting / Running Jobs"
71 for p in plistnumeric:
72 users = jpd[repr(p)].keys()
73 for u in users:
74 njobs = len(jpd[repr(p)][u])
75 print "%7d %8s %5d %5d" % (p, u, njobs, sd[u]['R'])
76

Properties

Name Value
svn:executable *
svn:keywords Id URL

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28