-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6077e21
commit 3bdc5ab
Showing
2 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
Submit the sbatch script and capture its job ID | ||
JOB_ID=$(sbatch test/mpi_tests/local_checks.sh | awk '{print $4}') | ||
echo "Submitted job with ID: $JOB_ID, output log: slurm-$JOB_ID.out" | ||
START_TIME=$(date +%s) | ||
# Loop until the job finishes | ||
while true; do | ||
# Check the status of the job | ||
STATUS=$(squeue -j $JOB_ID | grep $JOB_ID | awk '{print $5}') | ||
ELAPSED_TIME=$(( $(date +%s) - $START_TIME )) | ||
# If the job status is 'PD' (pending) or 'R' (running), wait and continue checking | ||
if [ "$STATUS" == "PD" ] || [ "$STATUS" == "R" ]; then | ||
sleep 60 | ||
echo "Job is still running... Elapsed time: $ELAPSED_TIME seconds." | ||
# If the job status is 'CF' (completed successfully), print success message and exit | ||
elif [ "$STATUS" == "CF" ]; then | ||
echo "Job completed successfully." | ||
exit 0 | ||
# If the job status is anything else, print error message and exit | ||
else | ||
echo "Error: Job failed or terminated. See slurm-$JOB_ID.out for more information." | ||
exit 1 | ||
fi | ||
done |