Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables with spaces break execution on clusters when using jobscript #1007

Closed
pcm32 opened this issue May 21, 2021 · 1 comment · Fixed by #1491
Closed

Environment variables with spaces break execution on clusters when using jobscript #1007

pcm32 opened this issue May 21, 2021 · 1 comment · Fixed by #1491
Labels
bug Something isn't working

Comments

@pcm32
Copy link

pcm32 commented May 21, 2021

Snakemake version

6.2.1

Describe the bug

When the workflow makes use of environment variables (by declaring them in envvars and then using them through os.environ), the workflow execution fails on batch schedulers because the jobscript gets the variable split by the space (it needs quoting).

Logs

Look at COVARIATE below

/nfs/my-path/.snakemake/tmp.fjbaxuov/snakejob.retrieve_data.3.sh: line 3: CACHE_PATH=/my-path/cache ACCESSIONS=E-MTAB-4395,E-MTAB-4342,E-MTAB-4128,E-MTAB-3826,E-MTAB-3173,E-MTAB-964,E-GEOD-62778,E-GEOD-54272 BATCH=study NEW_ACCESSION=E-CORN-1 COVARIATE=organism part COVARIATE_TYPE=characteristic: No such file or directory

Minimal example

Run any workflow that uses an env variable that has a space in the value in a cluster environment. On a local execution (no cluster), there is no issue.

Additional context

I suspect that the issue is here: https://github.com/snakemake/snakemake/blob/main/snakemake/executors/__init__.py#L795
although changing that on my side doesn't resolve the problem entirely, but I'm sure that the unquoted values are not helping. Unfortunately debugging this is difficult since the jobscript (snakejob.retrieve_data.3.sh) is deleted when snakemake exists.

@pcm32 pcm32 added the bug Something isn't working label May 21, 2021
@pcm32
Copy link
Author

pcm32 commented May 21, 2021

I went into the code and saved the file separately to another location. Besides the space, the problem seems to be that all envvars get surrounded in single quotes, acting as a single entity. This is resolved by setting https://github.com/snakemake/snakemake/blob/main/snakemake/executors/__init__.py#L801 to False. After that all seems to work. Will PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant