File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
.github/workflows/phoenix Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,24 @@ echo "🚀 Submitted SLURM job $JOBID"
6565# if this wrapper is killed/canceled, make sure SLURM job is cleaned up
6666trap ' [[ -n "${JOBID:-}" ]] && scancel "$JOBID" >/dev/null 2>&1 || :' EXIT
6767
68- # poll until job finishes
69- while true ; do
70- STATE=$( sacct -j " $JOBID " --noheader --format=State | head -1 | cut -d' ' -f1)
68+ # ────────── Poll until SLURM job finishes ──────────
69+ while : ; do
70+ # First try sacct (may take a moment to appear)
71+ STATE=$( sacct -j " $JOBID " --format=State --noheader --parsable2 | head -n1)
72+
73+ # If sacct didn’t return anything yet, check squeue
74+ if [[ -z " $STATE " ]]; then
75+ STATE=$( squeue -j " $JOBID " -h -o " %T" || echo " " )
76+ fi
77+
78+ # When both are empty, the job has left the queue
79+ if [[ -z " $STATE " ]]; then
80+ echo " ✅ SLURM job $JOBID no longer in queue; assuming finished"
81+ break
82+ fi
83+
7184 echo " ⏳ SLURM job $JOBID state: $STATE "
72- case " $STATE " in
73- COMPLETED|FAILED|CANCELLED|TIMEOUT) break ;;
74- * ) sleep 10 ;;
75- esac
85+ sleep 10
7686done
7787
7888# show final report
You can’t perform that action at this time.
0 commit comments