enryh
enryh

Reputation: 93

snakemake envvars are not passed to cluster execution (snakemake throws an error)

I define envvars to be passed to a shell script.

envvars:
    "PASS"

If I forget to specify them in the shell, the dry-run using snakemake -n will remind me to set it. Execution works just fine on my local machine, but I do not manage to pass the envvars to my cluster environment. I run into the following snakemake error after my cluster execution although I set the environment variable. The job is never launched due to the snakemake error.

WorkflowError in line 10 of /home/workflows/Snakefile:
The following environment variables are requested by the workflow but undefined. Please make sure that they are correctly defined before running Snakemake:
PASS
  File "/home/workflows/Snakefile", line 11, in <module>

after executing snakemake using snakemake --jobs 2 --latency-wait 30 --cluster "qsub ...". Explicitly specifying the envvars did not help: snakemake --jobs 2 --latency-wait 30 --cluster "qsub ..." --envvars PASS.

Is snakemake executed again in a different shell other the initial snakemake client shell?

Upvotes: 1

Views: 521

Answers (1)

Manavalan Gajapathy
Manavalan Gajapathy

Reputation: 4089

Looks like you need to add flag -V to qsub to make environment variables available to qsub jobs.

-V    Declares that all environment variables in the qsub commands environment are to be exported to the batch job.

Upvotes: 1

Related Questions