/[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 2621 - (show annotations) (download)
Sun May 19 09:18:43 2013 UTC (9 years, 4 months ago) by templon
File size: 1580 byte(s)
added line to indicate 'neutral' rank

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 sd['NEUTRAL'] = { 'R' : 888888 }
49
50 lines = outp2.split('\n')[5:]
51
52 jpd = dict()
53 for line in lines:
54 if line == '': break
55 flds = line.split()
56 jid = flds[JID]
57 rank = flds[SCHEDRANK]
58 if jid in jud.keys():
59 usr = jud[jid]
60 if rank not in jpd.keys():
61 jpd[rank] = dict()
62 if usr not in jpd[rank].keys():
63 jpd[rank][usr] = list()
64 jpd[rank][usr].append(jid)
65
66 jpd['6000'] = { 'NEUTRAL' : 888888*[1] }
67 plist = jpd.keys()
68 plistnumeric = list()
69 for k in plist:
70 plistnumeric.append(int(k))
71 plistnumeric.sort(reverse=True)
72
73 print "Sched.rank User Waiting / Running Jobs"
74 for p in plistnumeric:
75 users = jpd[repr(p)].keys()
76 for u in users:
77 njobs = len(jpd[repr(p)][u])
78 print "%7d %8s %5d %5d" % (p, u, njobs, sd[u]['R'])
79

Properties

Name Value
svn:executable *
svn:keywords Id URL

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