Skip to content

Commit

Permalink
empty squeue output -> no jobs, not a parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
John Brunelle committed Sep 6, 2014
1 parent 3d151c1 commit 6002e14
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/python/site-packages/slurmmon/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,20 @@ def get_jobs_running_on_host(hostname):
stdout = util.runsh(shv).strip()
for line in stdout.split('\n'):
line = line.strip()
try:
JobID, User, NCPUS, NNodes = line.split()

j = Job()
j['JobID'] = JobID
j['User'] = User
j['NCPUS'] = NCPUS
j['NNodes'] = NNodes
if line!='':
try:
JobID, User, NCPUS, NNodes = line.split()

yield j
j = Job()
j['JobID'] = JobID
j['User'] = User
j['NCPUS'] = NCPUS
j['NNodes'] = NNodes

except Exception, e:
sys.stderr.write("*** ERROR *** unable to parse squeue job text [%r]: %s\n" % (line, e))
yield j

except Exception, e:
sys.stderr.write("*** ERROR *** unable to parse squeue job text [%r]: %s\n" % (line, e))


#--- utilities
Expand Down

0 comments on commit 6002e14

Please sign in to comment.