Getting an interactive job with Slurm
I keep getting this wrong (forgetting the --pty
option), so all (Slurm users) recite together now:
# tmux on the remote node (job will end when tmux exits, so it is safe to disconnect)
srun --nodes=1 --tasks-per-node=20 --partition=some_queue --job-name=my_job --pty tmux
# plain bash (N.B. job will end when your bash shell ends)
srun --nodes=1 --tasks-per-node=20 --partition=some_queue --job-name=my_job --pty /bin/bash
Also, be careful when source
ing files if you use the /bin/bash
option - if the sourced files does a set -e
then the first command to exit with a non-zero exit status including after the sourced file has finished will terminate your bash shell (a general problem), which will terminate your job (a batch-processing problem). I have been bitten more than once by this and am now in the habit of set +e
after every source
command, to be sure.