2017-08-24 13:54:34 +02:00
|
|
|
# Job + Remaining time
|
2017-08-24 16:39:26 +02:00
|
|
|
|
2019-02-05 16:03:18 +01:00
|
|
|
[[ -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 }')
|
2017-08-24 16:39:26 +02:00
|
|
|
|
2018-02-25 13:04:07 +01:00
|
|
|
__slurm_ps1_remaining_time() {
|
2017-08-24 13:54:34 +02:00
|
|
|
if [ -n "$SLURM_JOB_ID" ]; then
|
|
|
|
DATE_NOW=$(date +%s)
|
|
|
|
DATE_JOB_START=$(stat -c %Y "/sys/fs/cgroup/cpu/slurm/uid_${UID}/job_${SLURM_JOB_ID}")
|
2017-08-24 16:39:26 +02:00
|
|
|
((DATE_TMP = (SLURM_JOB_WALLTIME_SECONDS - DATE_NOW + DATE_JOB_START) / 60))
|
2017-08-24 13:54:34 +02:00
|
|
|
echo -n "[SLURM$SLURM_JOB_ID->$DATE_TMP]"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-02-25 13:04:07 +01:00
|
|
|
[[ -n $INTERACTIVE && -n $SLURM_PTY_PORT ]] && (
|
2019-02-05 16:03:18 +01:00
|
|
|
echo "[SLURM] SLURM_JOB_ID=${SLURM_JOB_ID}"
|
2017-08-24 13:54:34 +02:00
|
|
|
echo "[SLURM] Your nodes are:"
|
2019-02-05 16:06:11 +01:00
|
|
|
[[ $(echo "$SLURM_JOB_CPUS_PER_NODE" | grep '(x') ]] && nbcpu=$(echo "$SLURM_JOB_CPUS_PER_NODE" | grep -o '^[^(]*' )
|
2019-02-05 16:02:58 +01:00
|
|
|
for node in $(scontrol show hostname "$SLURM_JOB_NODELIST") ; do
|
|
|
|
i=$((i+1))
|
|
|
|
echo " ${node}*${nbcpu:-$(echo "$SLURM_JOB_CPUS_PER_NODE" | cut -d, -f$i)}"
|
|
|
|
done
|
2017-08-24 13:54:34 +02:00
|
|
|
) || true
|
|
|
|
|
2017-10-05 10:56:45 +02:00
|
|
|
alias sql=' squeue -la'
|
|
|
|
alias sqlu='squeue -la -u $USER'
|
|
|
|
alias ssj=' scontrol show job'
|
|
|
|
alias sp=' sprio'
|
|
|
|
alias spl=' sprio -l'
|
|
|
|
alias sd=' sinfo -d'
|
|
|
|
alias i=' srun -p interactive --qos qos-interactive --time=5:0 --pty bash -i'
|
|
|
|
alias ix=' srun -p interactive --qos qos-interactive --time=5:0 --x11 --pty bash -i'
|
|
|
|
|
2018-02-25 13:04:07 +01:00
|
|
|
sjoin() {
|
|
|
|
if [[ -z $1 ]]; then
|
|
|
|
echo "Job ID not given."
|
|
|
|
else
|
|
|
|
JOBID=$1
|
|
|
|
[[ -n $2 ]] && NODE="-w $2"
|
2019-02-05 16:03:18 +01:00
|
|
|
srun --jobid "$JOBID" "$NODE" --pty bash -i
|
2018-02-25 13:04:07 +01:00
|
|
|
fi
|
2017-10-05 10:56:45 +02:00
|
|
|
}
|
2018-02-25 13:04:07 +01:00
|
|
|
irisstat() {
|
2017-10-05 10:56:45 +02:00
|
|
|
printf "%34s\n" "alloc/idle/other/total"
|
|
|
|
printf "%11s %s\n" "IRIS" "$(sinfo -h --format=%C | paste -sd " ")"
|
|
|
|
for p in batch interactive long; do
|
2018-02-25 13:04:07 +01:00
|
|
|
usagedata=$(sinfo -h -p $p --format=%C | paste -sd " ")
|
|
|
|
printf "%11s %s\n" $p "$usagedata"
|
2017-10-05 10:56:45 +02:00
|
|
|
done
|
|
|
|
}
|