Last active
October 23, 2023 15:03
-
-
Save MVesuviusC/807e773a5b269c0e8b5c3cd70e5118ce to your computer and use it in GitHub Desktop.
get time till next maintenance on the HPC
This file contains hidden or 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
get_maint_time () { | |
maint_start=$(scontrol show -u root reservation \ | |
| perl -pe 's/\n/#/g' \ | |
| perl -pe 's/#ReservationName=/\n/g' \ | |
| grep MAINT \ | |
| perl -ne '/.+StartTime=(.+)\sEndTime/; print $1;') | |
difftime=$(($(date +%s -d "$maint_start") - $(date +%s) - 1000)) | |
req_len=$(date -d "@$difftime" "+$(($difftime/86400))-%H:%M:%S") | |
echo $req_len | |
} | |
alias salloc_l='salloc --time=$(get_maint_time)' | |
alias srun_l='srun --time=$(get_maint_time)' | |
alias sbatch_l='sbatch --time=$(get_maint_time)' | |
# Change time limit on a job: | |
scontrol update jobid=4272971 TimeLimit=2-00:00:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment