File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments