diff --git a/lib/galaxy/jobs/runners/slurm.py b/lib/galaxy/jobs/runners/slurm.py index 98c373d96645..db1ed9b3d002 100644 --- a/lib/galaxy/jobs/runners/slurm.py +++ b/lib/galaxy/jobs/runners/slurm.py @@ -7,7 +7,10 @@ from galaxy import model from galaxy.jobs.runners.drmaa import DRMAAJobRunner -from galaxy.util import commands +from galaxy.util import ( + commands, + unicodify, +) from galaxy.util.custom_logging import get_logger log = get_logger(__name__) @@ -212,12 +215,12 @@ def __check_memory_limit(self, efile_path): """ try: log.debug("Checking %s for exceeded memory message from SLURM", efile_path) - with open(efile_path) as f: + with open(efile_path, "rb") as f: if os.path.getsize(efile_path) > 2048: f.seek(-2048, os.SEEK_END) f.readline() for line in f.readlines(): - stripped_line = line.strip() + stripped_line = unicodify(line.strip()) if stripped_line == SLURM_MEMORY_LIMIT_EXCEEDED_MSG: return OUT_OF_MEMORY_MSG elif any(_ in stripped_line for _ in SLURM_MEMORY_LIMIT_EXCEEDED_PARTIAL_WARNINGS):