-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved CI robustness for reverting back to **CI-Ready** from any given state New Features: - Improved `scancel` routine (refactored into bash "subroutine") - Improved messaging (see below) when ever a user changes state - Any and all previous build scripts and running experiments are killed as a result of reset to **Ready** Resolves #2060
- Loading branch information
1 parent
73621e9
commit a286a11
Showing
5 changed files
with
120 additions
and
45 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
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
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,24 @@ | ||
#!/bin/env bash | ||
|
||
function cancel_slurm_jobs() { | ||
|
||
# Usage: cancel_slurm_jobs <substring> | ||
# Example: cancel_slurm_jobs "C48_ATM_3c4e7f74" | ||
# | ||
# Cancel all Slurm jobs that have the given substring in their name | ||
# So like in the example all jobs with "C48_ATM_3c4e7f74" | ||
# in their name will be canceled | ||
|
||
local substring=$1 | ||
local job_ids | ||
job_ids=$(squeue -u "${USER}" -h -o "%i") | ||
|
||
for job_id in ${job_ids}; do | ||
job_name=$(sacct -j "${job_id}" --format=JobName%100 | head -3 | tail -1 | sed -r 's/\s+//g') || true | ||
if [[ "${job_name}" =~ ${substring} ]]; then | ||
echo "Canceling Slurm Job ${job_name} with: scancel ${job_id}" | ||
scancel "${job_id}" | ||
continue | ||
fi | ||
done | ||
} |