Hello,
I’m reopening this thread again because I would like to know if there is a conditional available to check the condition and if the condition met directly exit.
This conditional is best when I want to execute a step based on a condition but what if I want to skip all the next steps based on a condition?
Is there any conditional available for this purpose?
The short answer is no, there is no shortcut to quit a CWL workflow early without failing the entire workflow.
Unlike make-like workflow systems, CWL and most DAG oriented workflow languages can’t arbitrary stop successfully in the middle.
You can throw a JavaScript exception inside any CWL expression, but beyond failing the workflow, the result is not predictable between engines. Some might give you partial outputs, some won’t.
It is possible to emulate the desired behavior, but not with a single construct. You would have to add a conditional to every step past a certain point, to see if the workflow should be short circuited. And then you would have to modify the outputs section to cope with the possibly skipped steps, by making those “later” outputs optional.