`errorStrategy` 设置停止当前进程但继续管道

`errorStrategy` setting to stop current process but continue pipeline

我有很多样本经历了一个有时会失败的过程(确定性地)。在这种情况下,我希望失败的进程停止,但所有其他示例仍然独立提交和处理。

如果我没理解错的话,设置errorStrategy 'ignore'会在失败的进程中继续执行脚本,这不是我想要的。 errorStrategy 'finish' 将停止提交新样本,即使其他样本没有理由也失败。虽然 errorStrategy 'retry' 在技术上可行(通过重复失败的过程,而好的过程通过),但这似乎不是一个好的解决方案。

我是不是漏掉了什么?

如果一个进程可以确定性地失败,那么以某种方式处理这种情况可能会更好。将 errorStrategy 指令设置为 'ignore' 将意味着忽略任何进程执行错误并允许您的工作流程继续。例如,如果进程以非零退出状态退出或者缺少一个或多个预期输出文件,您可能会遇到进程执行错误。管道将继续,但不会尝试下游过程。

test.nf 的内容:

nextflow.enable.dsl=2

process foo {

    tag { sample }

    input:
    val sample

    output:
    path "${sample}.txt"

    """
    if [ "${sample}" == "s1" ] ; then
        (exit 1)
    fi
    if [ "${sample}" == "s2" ] ; then
        echo "Hello" > "${sample}.txt"
    fi
    """
}

process bar {

    tag { txt }

    input:
    path txt

    output:
    path "${txt}.gz"

    """
    gzip -c "${txt}" > "${txt}.gz"
    """
}

workflow {

    Channel.of('s1', 's2', 's3') | foo | bar
}

nextflow.config 的内容:

process {

  // this is the default task.shell:
  shell = [ '/bin/bash', '-ue' ]

  errorStrategy = 'ignore'
}

运行 与:

nextflow run -ansi-log false test.nf

结果:

N E X T F L O W  ~  version 20.10.0
Launching `test.nf` [drunk_bartik] - revision: e2103ea23b
[9b/56ce2d] Submitted process > foo (s2)
[43/0d5c9d] Submitted process > foo (s1)
[51/7b6752] Submitted process > foo (s3)
[43/0d5c9d] NOTE: Process `foo (s1)` terminated with an error exit status (1) -- Error is ignored
[51/7b6752] NOTE: Missing output file(s) `s3.txt` expected by process `foo (s3)` -- Error is ignored
[51/267685] Submitted process > bar (s2.txt)