#!/bin/bash
set -euo pipefail

# Submit this script from snakemake-workshop/work-cluster-a.
cd "${SLURM_SUBMIT_DIR:?Submit this script with sbatch from the workflow directory}"
source ../.venv/bin/activate

# The teaching rules each run one serial Python process.
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
export MKL_NUM_THREADS=1

exec snakemake --executor local --scheduler greedy \
    --cores "${SLURM_CPUS_PER_TASK:?Request CPUs with sbatch --cpus-per-task}" \
    --resources mem_mb=1024 --printshellcmds
