From 5b51806ca865ad65e8155553e86aa4603fece953 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 12 Jun 2019 15:24:41 -0400 Subject: [PATCH] Py3 type fixes in the Slurm runner --- lib/galaxy/jobs/runners/slurm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/jobs/runners/slurm.py b/lib/galaxy/jobs/runners/slurm.py index ec2ce131d45..9b5b3b7600b 100644 --- a/lib/galaxy/jobs/runners/slurm.py +++ b/lib/galaxy/jobs/runners/slurm.py @@ -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 = []