Merge branch 'release_19.05' into dev

This commit is contained in:
Nicola Soranzo
2019-06-13 11:11:15 +01:00
+5 -3
View File
@@ -10,6 +10,7 @@ import time
from galaxy import model
from galaxy.jobs.runners.drmaa import DRMAAJobRunner
from galaxy.util import unicodify
from galaxy.util.logging import get_logger
log = get_logger(__name__)
@@ -51,7 +52,7 @@ class SlurmJobRunner(DRMAAJobRunner):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
stderr = stderr.strip()
stderr = unicodify(stderr).strip()
if stderr == 'SLURM accounting storage is disabled':
log.warning('SLURM accounting storage is not properly configured, unable to run sacct')
return
@@ -59,7 +60,7 @@ class SlurmJobRunner(DRMAAJobRunner):
# First line is for 'job_id'
# Second line is for 'job_id.batch' (only available after the batch job is complete)
# Following lines are for the steps 'job_id.0', 'job_id.1', ... (but Galaxy does not use steps)
first_line = stdout.splitlines()[0]
first_line = unicodify(stdout).splitlines()[0]
# Strip whitespaces and the final '+' (if present), only return the first word
return first_line.strip().rstrip('+').split()[0]
@@ -77,6 +78,7 @@ class SlurmJobRunner(DRMAAJobRunner):
stdout, stderr = p.communicate()
if p.returncode != 0:
# Will need to be more clever here if this message is not consistent
stderr = unicodify(stderr)
if stderr == 'slurm_load_jobs error: Invalid job id specified\n':
# The job may be old, try to get its state with sacct
job_state = _get_slurm_state_with_sacct(job_id, cluster)
@@ -84,7 +86,7 @@ class SlurmJobRunner(DRMAAJobRunner):
return job_state
return 'NOT_FOUND'
raise Exception('`%s` returned %s, stderr: %s' % (' '.join(cmd), p.returncode, stderr))
stdout = stdout.strip()
stdout = unicodify(stdout).strip()
# stdout is a single line in format "key1=value1 key2=value2 ..."
job_info_keys = []
job_info_values = []