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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 78 by templon, Fri Feb 27 10:22:17 2009 UTC revision 109 by templon, Mon Mar 2 15:04:16 2009 UTC
# Line 6  Line 6 
6  # get information from pbs/torque LRMS, spit it out in uniform format  # get information from pbs/torque LRMS, spit it out in uniform format
7    
8  def usage():  def usage():
9      print "Usage: lrmsinfo-pbs -h <cfg_file>"      print "Usage: lrmsinfo-pbs [-i <input_file>]"
10        print "  input_file : optional text file containing 'qstat -f' output"
11    
12  import sys, getopt  import sys, getopt, string
13    
14  try:  try:
15      opts, args = getopt.getopt(sys.argv[1:], "h:i:",      opts, args = getopt.getopt(sys.argv[1:], "i:",
16                                 ["host=","input="])                                 ["input="])
17  except getopt.GetoptError:  except getopt.GetoptError:
18      # print help information and exit:      # print help information and exit:
19      print sys.argv[0] + ": error parsing command line: " + \      print sys.argv[0] + ": error parsing command line: " + \
# Line 20  except getopt.GetoptError: Line 21  except getopt.GetoptError:
21      usage()      usage()
22      sys.exit(2)      sys.exit(2)
23    
 hostname = None  
24  infile = None  infile = None
25    
26  for o, a in opts:  for o, a in opts:
27      if o in ("-h", "--host"):      if o in ("-i", "--input"):
         hostname = a  
     elif o in ("-i", "--input"):  
28          infile = a          infile = a
29                    
30  if infile:  if infile:
31      cmd = '/bin/cat ' + infile      cmd = '/bin/cat ' + infile
32  else:  else:
33      cmd = 'diagnose -g'      cmd = 'diagnose -g'
     if hostname:  
         cmd = cmd + ' --host=' + hostname  
34    
35  sys.path.append('@MODDIR@')  sys.path.append('@MODDIR@')
36  from pbsServer import LiveServer  from pbsServer import LiveServer
37  if infile:  if infile:
38      bq = LiveServer(file=infile)      bq = LiveServer(file=infile)
 elif hostname:  
     bq = LiveServer(host=hostname)  
39  else:  else:
40      bq = LiveServer()      bq = LiveServer()
41    

Legend:
Removed from v.78  
changed lines
  Added in v.109

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