Skip to content

Commit

Permalink
Merge pull request #18338 from mvdbeek/fix_memory_limit_check
Browse files Browse the repository at this point in the history
[24.0] Fix seek in slurm memory check
  • Loading branch information
jdavcs authored Jun 6, 2024
2 parents dc145ed + cf322eb commit 35a758b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/galaxy/jobs/runners/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 35a758b

Please sign in to comment.