【问题标题】:Snakemake claims rule exits with non-zero exit code, even with "|| true"?Snakemake 声明规则以非零退出代码退出,即使使用“|| true”?
【发布时间】:2019-06-20 20:50:11
【问题描述】:

我的snakemake管道断言,每当我运行任何规则时,我的代码都会引发非零退出代码,即使如果我手动运行相同的代码,我的代码会返回错误代码 0,并且在运行时它可以正常工作蛇人。

根据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。

snakemake 是怎么做的?作为参考,我使用的是蛇形 5.5.0 和 python 3.7.0,我使用的服务器有 Ubuntu 16.04.5,如果相关的话。

【问题讨论】:

  • 我无法重现这一点。这是我尝试过的: 1. 创建了一个新目录并将cd'd 放入其中。 2. 将您的规则复制粘贴到Snakefile。 3. mkdir input output 创建目录。 4.touch input/file,5.冉snakemake。我得到的不是“(以非零退出代码退出)”,而是“python3.7:无法打开文件'scripts/script.py'[...]”,然后是“MissingOutputException”预期的。你能尝试同样的事情,看看它是否仍然发生?确保使用你帖子中的信息完全按照描述在一个干净的目录中尝试。不要重复使用你现有的项目文件
  • 我遇到了同样的问题。除了|| true,我还尝试将set +eexit 0 添加到shell 命令中——仍然是同样的问题。你找到解决方案了吗?
  • soungalo 抱歉,但在我从事该项目(大约一年前我离开)时,我们无法解决这种不一致问题。

标签: python bash snakemake


【解决方案1】:

我在 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'
        """

作品

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-08
    • 2014-10-10
    • 2015-07-02
    • 1970-01-01
    • 2020-12-28
    相关资源
    最近更新 更多