/[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 2012 - (show annotations) (download)
Fri Oct 8 13:11:04 2010 UTC (11 years, 11 months ago) by templon
File size: 1256 byte(s)
first checkin, copied from old tree

1 #!/usr/bin/python2
2 # lrmsinfo-pbs
3 # J. A. Templon, NIKHEF/PDP 2005
4 # @(#)$Id$
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: ***

Properties

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

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