Reputation: 362
My snakemake pipeline asserts that my code raises a non-zero exit code whenever I run any rule, even though my code returns an error code of 0 if I manually run the same exact code, and it works perfectly normally when ran in Snakemake.
As per the advice of this question, I tried appending || true
to the shell command in the snakemake rule, changing my rule from looking like
rule rulename:
input:
"input/file"
output:
"output/file"
shell:
"python3.7 scripts/script.py {input} {output}"
to
rule rulename:
input:
"input/file"
output:
"output/file"
shell:
"python3.7 scripts/script.py {input} {output} || true"
However, when I re-run the pipeline, snakemake still errors and says, (exited with non-zero exit code)
, even though the || true
at the end will ensure that this command always returns an exit code of 0.
What is snakemake doing to cause that? For reference, I am using snakemake 5.5.0 with python 3.7.0, and the server I'm using has Ubuntu 16.04.5, if that's relevant.
Upvotes: 2
Views: 1979
Reputation: 1944
I had this problem when running docker in Snakemake without propagating my userid to the container. The script can run but if Snakemake can't touch the output as your user it will return this cryptic error.
rule helloworld:
output: "output_10/test"
shell:
"""
docker run -v $PWD:/work -w /work someimage somecommand > output_10/test'
"""
(exited with non-zero exit code)
rule helloworld:
output: "output_10/test"
shell:
"""
docker run --user $(id -u):$(id -g) -v $PWD:/work -w /work someimage somecommand > output_10/test'
"""
works
Upvotes: 0