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



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

如果我理解正确,设置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)

最新更新