Skip to content

Commit

Permalink
Fix slurm exit-code detection
Browse files Browse the repository at this point in the history
  • Loading branch information
verveerpj committed Dec 3, 2024
1 parent 309a535 commit 1d0de82
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/ert/scheduler/slurm_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,13 @@ async def _poll_once_by_scontrol(
return self._scontrol_cache[missing_job_id]

process = await asyncio.create_subprocess_exec(
self._scontrol,
"show",
"job",
"sacct",
"-X",
"-n",
" -o",
"State,ExitCode",
"-P",
"-j",
str(missing_job_id),
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
Expand Down Expand Up @@ -441,9 +445,8 @@ def _seconds_to_slurm_time_format(seconds: float) -> str:


def _parse_scontrol_output(output: str) -> ScontrolInfo:
values = dict(w.split("=", 1) for w in output.split())
exit_code_str = values.get("ExitCode")
state_str, exit_code_str = output.split("|")
exit_code = None
if exit_code_str:
exit_code = int(exit_code_str.split(":")[0])
return ScontrolInfo(JobStatus[values["JobState"]], exit_code)
exit_code = int(output.split(":")[0])
return ScontrolInfo(JobStatus[state_str], exit_code)

0 comments on commit 1d0de82

Please sign in to comment.