Skip to content

Commit b55a21e

Browse files
sbryngelsonclaude
andcommitted
ci: log last sbatch error output on retry exhaustion
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ff18b55 commit b55a21e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/scripts/retry-sbatch.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ retry_sbatch() {
1111
local script_contents="$1"
1212
local max_attempts=3
1313
local attempt=1
14-
local submit_output job_id
14+
local submit_output job_id last_output=""
1515

1616
while [ $attempt -le $max_attempts ]; do
1717
echo "sbatch attempt $attempt of $max_attempts..." >&2
@@ -21,6 +21,7 @@ retry_sbatch() {
2121
echo "$job_id"
2222
return 0
2323
fi
24+
last_output="$submit_output"
2425
echo "sbatch failed: $submit_output" >&2
2526
if ! echo "$submit_output" | grep -qiE "timed out|connection refused|connection reset|try again|temporarily unavailable"; then
2627
echo "Non-transient sbatch failure — not retrying." >&2
@@ -33,6 +34,6 @@ retry_sbatch() {
3334
attempt=$((attempt + 1))
3435
done
3536

36-
echo "sbatch failed after $max_attempts attempts." >&2
37+
echo "sbatch failed after $max_attempts attempts. Last error: $last_output" >&2
3738
return 1
3839
}

0 commit comments

Comments
 (0)