-
I am trying to run a process with multiple exceptions for different error codes. Basically a process can die from memory for instance or from an internal error I want nextflow to ignore. Is there a nice way of doing that? I have tried
but with this I get this error instead of ignoring it -> I also tried this but seems it's not accepted by the syntax
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @davidmasp , This is a really interesting problem and I wonder if we could try to use one of the following approaches
errorStrategy { task.exitStatus == 124 ? 'retry' : task.exitStatus == 123 ? 'ignore' : 'terminate' }
This idea is based on an analogues behavior in the JS world regarding nested ternary operators which make code somewhat "cleaner".
def myExitStrategy(exitStatus) {
switch(exitStatus) {
case 124:
'retry'
case 123:
'ignore'
default:
'terminate'
}
}
process XYZ {
...
errorStrategy myExitStrategy(task.exitStatus)
...
} Curious to hear which one gets us closer to the goal. Disclaimer: I haven't used either one in my own code so far (haven't come across a similar situation at all), so take these suggestions with a grain of salt. |
Beta Was this translation helpful? Give feedback.
-
Okay, I managed to make it work using a if/else statement. Something like this:
A full reproducible version of this should be available here EDIT:
|
Beta Was this translation helpful? Give feedback.
Okay, I managed to make it work using a if/else statement. Something like this:
A full reproducible version of this should be available here
EDIT:
As suggested by @abhi18av I have tested this solution which is more elegant and also works fine!