Skip to content

Commit

Permalink
Added casting to string of slurm_stderr and jobinfo_stdout
Browse files Browse the repository at this point in the history
For compatibility with Python 3, where subprocess is returning bytes instead of string
  • Loading branch information
pietromarchesi committed Feb 2, 2018
1 parent de6cb43 commit 9dc96cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sciluigi/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ def log_slurm_info(self, slurm_stderr):
salloc: Job allocation 5836263 has been revoked.
'''

matches = re.search('[0-9]+', slurm_stderr)
matches = re.search('[0-9]+', str(slurm_stderr))
if matches:
jobid = matches.group(0)

# Write slurm execution time to audit log
cmd = 'sacct -j {jobid} --noheader --format=elapsed'.format(jobid=jobid)
(_, jobinfo_stdout, _) = self.ex_local(cmd)
sacct_matches = re.findall('([0-9\:\-]+)', jobinfo_stdout)
sacct_matches = re.findall('([0-9\:\-]+)', str(jobinfo_stdout))

if len(sacct_matches) < 2:
log.warn('Not enough matches from sacct for task %s: %s',
Expand Down

0 comments on commit 9dc96cb

Please sign in to comment.