Skip to content

Commit a82959e

Browse files
sbryngelsonclaude
andcommitted
Use parsable sacct flags for robust state parsing
Use -n -X -P flags with sacct: -X restricts to job allocation (not steps), -P gives pipe-delimited output for reliable parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c6b6f81 commit a82959e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/scripts/monitor_slurm_job.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ get_job_state() {
4545

4646
# Fallback to sacct (works for completed/historical jobs)
4747
if command -v sacct >/dev/null 2>&1; then
48-
state=$(sacct -j "$jid" --format=State --noheader 2>/dev/null | head -n1 | awk '{print $1}')
48+
state=$(sacct -j "$jid" -n -X -P -o State 2>/dev/null | head -n1 | cut -d'|' -f1)
4949
if [ -n "$state" ]; then
5050
echo "$state"
5151
return

0 commit comments

Comments
 (0)