Search code examples
cronslurmsnakemakesbatch

Error submitting jobscript (exit code 127) when invoking snakemake through cron job on SLURM cluster


I'm trying to run a snakemake pipeline through crontab on a SLURM cluster. Here is the bash script that I used to send to the slurm.

#!/bin/bash
#SBATCH --job-name=nextstrain

snakemake --configfile config.yaml --jobs 100 --keep-going --rerun-incomplete --latency-wait 360 --cluster 'sbatch' -r -p --useconda

This scrip runs as intended. However, when I run the script through crontab as so:

0 8 * * 1 /bin/bash /home/user/snakemake_automate.sh

I get the error:

Error submitting jobscript (exit code 127):

I am not sure what I should do to fix this error.


Solution

  • Exit code 127 means command not found I suspect you need to load a module or conda env prior to invoking snakemake. When you run the script interactively it will use your current environment, but through cron it may not source your bashrc or similar.