/[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 78 - (hide annotations) (download)
Fri Feb 27 10:22:17 2009 UTC (13 years, 6 months ago) by templon
File size: 1391 byte(s)
changing repo structure

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     print "Usage: lrmsinfo-pbs -h <cfg_file>"
10    
11     import sys, getopt
12    
13     try:
14     opts, args = getopt.getopt(sys.argv[1:], "h:i:",
15     ["host=","input="])
16     except getopt.GetoptError:
17     # print help information and exit:
18     print sys.argv[0] + ": error parsing command line: " + \
19     string.join(sys.argv)
20     usage()
21     sys.exit(2)
22    
23     hostname = None
24     infile = None
25    
26     for o, a in opts:
27     if o in ("-h", "--host"):
28     hostname = a
29     elif o in ("-i", "--input"):
30     infile = a
31    
32     if infile:
33     cmd = '/bin/cat ' + infile
34     else:
35     cmd = 'diagnose -g'
36     if hostname:
37     cmd = cmd + ' --host=' + hostname
38    
39     sys.path.append('@MODDIR@')
40     from pbsServer import LiveServer
41     if infile:
42     bq = LiveServer(file=infile)
43     elif hostname:
44     bq = LiveServer(host=hostname)
45     else:
46     bq = LiveServer()
47    
48     tf = sys.stdout
49     tf.write("nactive %d\n" % (bq.slotsUp))
50     tf.write("nfree %d\n" % (bq.slotsFree))
51     tf.write("now %d\n" % (bq.now))
52     tf.write("schedCycle %d\n" % (bq.schedCycle))
53    
54     for job in bq.jobs():
55     tf.write(job.attDictString() + "\n")
56    
57     tf.close()
58    
59     ### Local Variables: ***
60     ### mode: python ***
61     ### End: ***

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