Skip to content

Commit fb6101d

Browse files
sbryngelsonclaude
andcommitted
ci: treat PREEMPTED as non-terminal so --requeue jobs keep being monitored
With #SBATCH --requeue, a preempted SLURM job restarts under the same job ID (PREEMPTED -> PENDING -> RUNNING). Previously PREEMPTED was listed as a terminal state, causing the monitor to exit immediately and report failure, discarding the requeue. Remove PREEMPTED from is_terminal_state() and add it to the PENDING branch of the pre-output-file wait loop so the monitor keeps polling through the preemption-requeue cycle and resumes streaming once the job restarts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ffb43f7 commit fb6101d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/scripts/monitor_slurm_job.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ get_job_state() {
6262
}
6363

6464
# Check if a state is terminal (job is done, for better or worse)
65+
# PREEMPTED is intentionally excluded: with --requeue the job restarts under
66+
# the same job ID and we must keep monitoring rather than exiting early.
6567
is_terminal_state() {
6668
case "$1" in
67-
COMPLETED|FAILED|CANCELLED|CANCELLED+|TIMEOUT|OUT_OF_MEMORY|NODE_FAIL|BOOT_FAIL|DEADLINE|PREEMPTED|REVOKED)
69+
COMPLETED|FAILED|CANCELLED|CANCELLED+|TIMEOUT|OUT_OF_MEMORY|NODE_FAIL|BOOT_FAIL|DEADLINE|REVOKED)
6870
return 0 ;;
6971
*)
7072
return 1 ;;
@@ -80,7 +82,7 @@ while [ ! -f "$output_file" ]; do
8082
state=$(get_job_state "$job_id")
8183

8284
case "$state" in
83-
PENDING|CONFIGURING)
85+
PENDING|CONFIGURING|PREEMPTED)
8486
unknown_count=0
8587
sleep 5
8688
;;

0 commit comments

Comments
 (0)