From 971149fe29f1292468aee1ced98318afeb27ca26 Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Wed, 12 Nov 2025 11:58:31 +1300 Subject: [PATCH] Make failure to lookup Slurm reason description non-fatal Alas there are a number of omissions in SlurmJobExecutor._REASONS_MAP. Specifically the one we encountered was OutOfMemory, but there are quite a few others missing. Trying to add them all seems not worthwhile. Instead reason lookup has been made robust. --- src/psij/executors/batch/slurm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/psij/executors/batch/slurm.py b/src/psij/executors/batch/slurm.py index 6f0963ee..a9198a04 100644 --- a/src/psij/executors/batch/slurm.py +++ b/src/psij/executors/batch/slurm.py @@ -180,8 +180,9 @@ def _get_state(self, state: str) -> JobState: return SlurmJobExecutor._STATE_MAP[state] def _get_message(self, reason: str) -> str: - assert reason in SlurmJobExecutor._REASONS_MAP - return SlurmJobExecutor._REASONS_MAP[reason] + return SlurmJobExecutor._REASONS_MAP.get( + reason, f"{reason} - no description available" + ) def job_id_from_submit_output(self, out: str) -> str: """See :meth:`~.BatchSchedulerExecutor.job_id_from_submit_output`."""