Tips and Shortcuts¶
This page has small helpers that make working with Slurm on RCC easier.
Check job completion with a code word¶
Add a unique code word as the last line of your script (e.g. echo "owlbear42"). You can then quickly check how many jobs completed successfully by grepping your log files:
# count jobs that completed successfully
grep -l "owlbear42" extract_chrom-*.out | wc -l
# list jobs that did NOT complete
grep -L "owlbear42" extract_chrom-*.out
submit.sh wrapper script¶
This convenience script wraps sbatch --wrap so you can quickly submit a one-liner command to the scheduler without writing a full submission script. Add it to your PATH so you can call it from anywhere:
THREADS=${1}
if [[ $THREADS =~ ^[0-9]+$ ]]; then
shift
PE="$THREADS"
else
PE="1"
fi
JOB_NAME=${1}
shift
timestamp=$(date '+%Y_%m_%d_%H_%M')
sbatch --job-name=${JOB_NAME} \
--output="${PWD}/report_files/${timestamp}_%x.%N.%j.out" \
--cpus-per-task=$PE \
--mem-per-cpu=4G \
--wrap="$*"
Usage:
submit.sh N JOB_NAME COMMAND
Example:
submit.sh 16 concatenate_VCFs bcftools concat -Oz *.filtered.vcf.gz -o outputVCF.vcf.gz
Useful .bashrc aliases¶
Add these to your ~/.bashrc for quick access to common commands:
# list files with human-readable sizes, newest last
alias l='ls -lrth'
# show only your own jobs in the queue
alias qq='squeue -u $USER'
# start a small interactive job (4 cores, 16GB)
alias int='srun -p ccdefault -J int -n 1 -c 4 --mem=16G --pty /bin/bash'
# start a large interactive job (48 cores, 180GB)
alias intbig='srun -p ccdefault -J intbig -n 1 -c 48 --mem=180G --pty /bin/bash'