/[pdpsoft]/nl.nikhef.pdp.dynsched-pbs-plugin/trunk/lrmsinfo-pbs.cin
ViewVC logotype

Contents of /nl.nikhef.pdp.dynsched-pbs-plugin/trunk/lrmsinfo-pbs.cin

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2014 - (show annotations) (download)
Fri Oct 8 13:12:58 2010 UTC (12 years ago) by templon
File size: 1260 byte(s)
add URL field

1 #!/usr/bin/python2
2 # lrmsinfo-pbs
3 # J. A. Templon, NIKHEF/PDP 2005
4 # $Id$
5 # $URL$
6
7 # get information from pbs/torque LRMS, spit it out in uniform format
8
9 def usage():
10 print "Usage: lrmsinfo-pbs [-i <input_file>]"
11 print " input_file : optional text file containing 'qstat -f' output"
12
13 import sys, getopt, string
14
15 try:
16 opts, args = getopt.getopt(sys.argv[1:], "i:",
17 ["input="])
18 except getopt.GetoptError:
19 # print help information and exit:
20 print sys.argv[0] + ": error parsing command line: " + \
21 string.join(sys.argv)
22 usage()
23 sys.exit(2)
24
25 infile = None
26
27 for o, a in opts:
28 if o in ("-i", "--input"):
29 infile = a
30
31 if infile:
32 cmd = '/bin/cat ' + infile
33 else:
34 cmd = 'diagnose -g'
35
36 sys.path.append('@TARGPREFIX@/@MODSUFFIX@')
37 from pbsServer import LiveServer
38 if infile:
39 bq = LiveServer(file=infile)
40 else:
41 bq = LiveServer()
42
43 tf = sys.stdout
44 tf.write("nactive %d\n" % (bq.slotsUp))
45 tf.write("nfree %d\n" % (bq.slotsFree))
46 tf.write("now %d\n" % (bq.now))
47 tf.write("schedCycle %d\n" % (bq.schedCycle))
48
49 for job in bq.jobs():
50 tf.write(job.attDictString() + "\n")
51
52 tf.close()
53
54 ### Local Variables: ***
55 ### mode: python ***
56 ### End: ***

Properties

Name Value
svn:eol-style native
svn:keywords Id URL

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