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

[bash,install.sh] Initial slurm integration

This commit is contained in:
Hyacinthe Cartiaux 2017-08-24 13:54:34 +02:00
parent 5087fb1863
commit f360b4c945
2 changed files with 18 additions and 0 deletions

17
bash/.bash_slurm Executable file
View file

@ -0,0 +1,17 @@
# Job + Remaining time
__slurm_ps1_remaining_time(){
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}")
DATE_TMP=$(sacct -j $SLURM_JOB_ID --format Timelimit | awk -F: '/:/ { print ($1 * 3600) + ($2 * 60) + $3 }')
((DATE_TMP = (DATE_TMP - DATE_NOW + DATE_JOB_START) / 60))
echo -n "[SLURM$SLURM_JOB_ID->$DATE_TMP]"
fi
}
test -n "$SLURM_PTY_PORT" && (
echo "[SLURM] SLURM_JOB_ID=$SLURM_JOB_ID"
echo "[SLURM] Your nodes are:"
srun bash -c 'echo " $(hostname)*$SLURM_CPUS_ON_NODE"' | sort
) || true

View file

@ -33,6 +33,7 @@ ln -sf $DOTFILES/bash/profile ~/.profile
ln -sf $DOTFILES/bash/bash_logout ~/.bash_logout
ln -sf $DOTFILES/bash/bash_environment ~/.bash_environment
ln -sf $DOTFILES/bash/bash_oar ~/.bash_oar
ln -sf $DOTFILES/bash/bash_slurm ~/.bash_slurm
ln -sf $DOTFILES/bash/bash_aliases ~/.bash_aliases
if [[ ! -f ~/.git-prompt.sh ]] ; then