python - Snakemake 声明规则以非零退出代码退出,即使使用“|| true”?
问题描述
我的 snakemake 管道断言,每当我运行任何规则时,我的代码都会引发非零退出代码,即使如果我手动运行相同的确切代码,我的代码会返回错误代码 0,并且在 Snakemake 中运行时它可以正常工作。
根据this question的建议,我尝试|| true
在snakemake规则中附加到shell命令,将我的规则从看起来像
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 仍然出错并说,,(exited with non-zero exit code)
即使|| true
最后会确保此命令始终返回退出代码 0。
是什么蛇制造导致这种情况?作为参考,我在 python 3.7.0 中使用了snakemake 5.5.0,如果相关的话,我使用的服务器有 Ubuntu 16.04.5。
解决方案
在 Snakemake 中运行 docker 而不将我的用户 ID 传播到容器时,我遇到了这个问题。该脚本可以运行,但如果 Snakemake 无法以您的用户身份触摸输出,它将返回此神秘错误。
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'
"""
作品
推荐阅读
- javascript - 移动视图菜单问题?
- c# - 为许多实现抽象类的类创建一个 DTO 是一种不好的做法吗?
- ios - UIGestureRecognizer 不向其他类发送操作
- c# - AleaGPU 适用于矩形内的点
- django-models - DRF - 在 SlugRelatedField 上使用包含字段查找的查询集过滤器
- mysql - 如果我 console.log 我的结果会显示,但如果我返回它不会
- testng - TestNG 如何处理子类中测试方法的重复优先级?
- node.js - 检查数组中是否存在未知字段
- java - 使用套接字打印原始文本
- go - 有没有办法在golang的一个进程中运行多个命令“os/exec”?