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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 109 - (hide annotations) (download)
Mon Mar 2 15:04:16 2009 UTC (13 years, 6 months ago) by templon
File size: 1297 byte(s)
Fix for savannah bug 35662 : command no longer accepts a hostname.

1 templon 78 #!/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 templon 109 print "Usage: lrmsinfo-pbs [-i <input_file>]"
10     print " input_file : optional text file containing 'qstat -f' output"
11 templon 78
12 templon 109 import sys, getopt, string
13 templon 78
14     try:
15 templon 109 opts, args = getopt.getopt(sys.argv[1:], "i:",
16     ["input="])
17 templon 78 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 templon 109 if o in ("-i", "--input"):
28 templon 78 infile = a
29    
30     if infile:
31     cmd = '/bin/cat ' + infile
32     else:
33     cmd = 'diagnose -g'
34    
35     sys.path.append('@MODDIR@')
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