We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 25a074e commit e59272aCopy full SHA for e59272a
1 file changed
.github/scripts/monitor_slurm_job.sh
@@ -52,6 +52,15 @@ get_job_state() {
52
# Fallback to sacct (works for completed/historical jobs)
53
if command -v sacct >/dev/null 2>&1; then
54
state=$(sacct -j "$jid" -n -X -P -o State 2>/dev/null | head -n1 | cut -d'|' -f1 || true)
55
+ # When a job is preempted+requeued, sacct -X reports PREEMPTED for the
56
+ # original attempt while the requeued run may have completed. Check all
57
+ # records (without -X) for a terminal state that supersedes PREEMPTED.
58
+ if [ "$state" = "PREEMPTED" ]; then
59
+ requeue_state=$(sacct -j "$jid" -n -P -o State 2>/dev/null | grep -v PREEMPTED | head -n1 | cut -d'|' -f1 || true)
60
+ if [ -n "$requeue_state" ]; then
61
+ state="$requeue_state"
62
+ fi
63
64
if [ -n "$state" ]; then
65
echo "$state"
66
return
0 commit comments