问题描述
我的snakemake管道断言,只要我运行任何规则,我的代码都会引发非零的退出代码,即使如果我手动运行相同的确切代码,我的代码也会返回错误代码0,并且在运行时它可以正常正常运行蛇行.
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.
按照,我尝试附加 ||true
到snakemake规则中的shell命令,将我的规则从看起来像
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}"
到
rule rulename:
input:
"input/file"
output:
"output/file"
shell:
"python3.7 scripts/script.py {input} {output} || true"
但是,当我重新运行管道时,snakemake仍会出错并说(退出代码为非零)
,即使 ||也是如此.最后,如果为true
,则将确保此命令始终返回退出代码0.
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.
snakemake在做什么导致这种情况?作为参考,我将python 3.7.0与snakemake 5.5.0结合使用,并且如果相关,我正在使用的服务器具有Ubuntu 16.04.5.
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.
推荐答案
在Snakemake中运行docker而不将我的userid传播到容器时,我遇到了这个问题.该脚本可以运行,但是如果Snakemake无法以您的用户身份触摸输出,它将返回此隐式错误.
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'
"""
(以非零退出代码退出)
rule helloworld:
output: "output_10/test"
shell:
"""
docker run --user $(id -u):$(id -g) -v $PWD:/work -w /work someimage somecommand > output_10/test'
"""
有效
这篇关于Snakemake声称规则退出使用非零退出代码,即使使用"||"也是如此真的"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!