Skip to content

Commit

Permalink
Fix Prevent AwS Batch retry the job execution when the container does…
Browse files Browse the repository at this point in the history
… not exist

Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jul 13, 2024
1 parent 17ec6c9 commit 4e218f2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import groovy.util.logging.Slf4j
import nextflow.BuildInfo
import nextflow.cloud.types.CloudMachineInfo
import nextflow.container.ContainerNameValidator
import nextflow.exception.ProcessException
import nextflow.exception.ProcessSubmitException
import nextflow.exception.ProcessUnrecoverableException
import nextflow.executor.BashWrapperBuilder
Expand Down Expand Up @@ -267,7 +268,10 @@ class AwsBatchTaskHandler extends TaskHandler implements BatchHandler<String,Job
// finalize the task
task.stdout = outputFile
if( job?.status == 'FAILED' || task.exitStatus==Integer.MAX_VALUE ) {
task.error = new ProcessUnrecoverableException(errReason(job))
final reason = errReason(job)
// retry all CannotPullContainer errors apart when it does not exist or cannot be accessed
final unrecoverable = reason.contains('CannotPullContainer') && reason.contains('unauthorized')
task.error = unrecoverable ? new ProcessUnrecoverableException(reason) : new ProcessException(reason)
task.stderr = executor.getJobOutputStream(jobId) ?: errorFile
}
else {
Expand Down

0 comments on commit 4e218f2

Please sign in to comment.