/[pdpsoft]/trunk/nl.nikhef.pdp.lrmsutils/lrms-pbs/lrmsinfo-pbs.cin
ViewVC logotype

Contents of /trunk/nl.nikhef.pdp.lrmsutils/lrms-pbs/lrmsinfo-pbs.cin

Parent Directory Parent Directory | Revision Log Revision Log


Revision 135 - (show annotations) (download)
Tue Mar 10 14:43:56 2009 UTC (13 years, 6 months ago) by templon
File size: 1312 byte(s)
ETICS compat changes

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

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