1
0
Fork 0
mirror of https://github.com/hcartiaux/dotfiles.git synced 2024-10-18 09:15:24 +02:00

[bash] Slurm : do not call scontrol outside of a job

This commit is contained in:
Hyacinthe Cartiaux 2017-08-31 18:58:13 +02:00
parent b7c906dc32
commit 85b1c21e71

View file

@ -1,6 +1,6 @@
# Job + Remaining time
[[ -z "$SLURM_JOB_WALLTIME_SECONDS" ]] && SLURM_JOB_WALLTIME_SECONDS=$(scontrol show job $SLURM_JOB_ID | grep -Po 'TimeLimit=\K[^ ]*' | awk -F: '/:/ { print ($1 * 3600) + ($2 * 60) + $3 }')
[[ -n "$SLURM_JOB_ID" && -z "$SLURM_JOB_WALLTIME_SECONDS" ]] && SLURM_JOB_WALLTIME_SECONDS=$(scontrol show job $SLURM_JOB_ID | grep -Po 'TimeLimit=\K[^ ]*' | awk -F: '/:/ { print ($1 * 3600) + ($2 * 60) + $3 }')
__slurm_ps1_remaining_time(){
if [ -n "$SLURM_JOB_ID" ]; then