/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/pjobstats/torqueJobs.py
ViewVC logotype

Diff of /trunk/nl.nikhef.ndpf.tools/pjobstats/torqueJobs.py

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

revision 2778 by templon, Wed Apr 16 15:52:57 2014 UTC revision 2779 by templon, Mon Mar 23 14:24:01 2015 UTC
# Line 116  def qs_parsejob(instring): Line 116  def qs_parsejob(instring):
116    
117  def qs_parsefile(ifilename):  def qs_parsefile(ifilename):
118      # function for parsing entire output of 'qstat -f'      # function for parsing entire output of 'qstat -f'
119        # can also pass an io.BytesIO object instead
120        import io
121        if type(ifilename) is str:
122            filestring = open(ifilename,'r').read().strip()
123        elif type(ifilename) is io.BytesIO:
124            filestring = ifilename.read().strip()
125        else:
126            print "unknown object", ifilename, "type", type(ifilename)
127            import sys
128            sys.exit(1)
129    
130      jobIDstr = 'Job Id: '      jobIDstr = 'Job Id: '
     filestring = open(ifilename,'r').read().strip()  
131      if len(filestring) == 0:  # then assume no jobs      if len(filestring) == 0:  # then assume no jobs
132          return list()          return list()
133      if filestring[:len(jobIDstr)] != jobIDstr:      if filestring[:len(jobIDstr)] != jobIDstr:

Legend:
Removed from v.2778  
changed lines
  Added in v.2779

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