When I’m developing a pipeline and want to see how things are going up to a certain point, I add return at the following line, and the pipeline will end there. It’s a useful little trick, though less valuable than live debugging with a fully powered IDE.
When talking about a proper exit during a pipeline run, there’s a Nextflow function specific to that named error. It’ll throw an exception. Let’s run the Nextflow pipeline below:
process FOO {
debug true
input:
val x
output:
stdout
script:
"""
echo FOO process ${x}
"""
}
process BAR {
debug true
input:
val x
output:
stdout
script:
"""
echo BAR process ${x}
"""
}
workflow {
Channel
.of(1..4)
.set { my_ch }
FOO(my_ch)
BAR(my_ch)
}
As you can see, though, it’s an abrupt error. It doesn’t really care what’s going on, as soon as the error call is evaluated, the pipeline is terminated. The best way to handle such situations is to use errorStrategy (more info here). As for skipping processes, there’s a snippet I posted earlier today that works out-of-the-box for nf-core pipelines, but can also be made to work in your own pipelines with a bit of work. Check it here.