By using AWS re:Post, you agree to the Terms of Use

How to use custom retry code for Batch job


I am trying to create conditions for my job to retry. To do this, I have a variable like

EXIT=“exit 25”

in the bash script that my job runs in the docker container, and lines like:

foo || eval $EXIT

Where if the command “foo” fails, the container will exit with code 25. Then, in the job definition, I have a condition for code 25 that tells the job to retry.

However, when this failure occurs, Batch recognizes the code 25 error (and identifies it as the reason for failure) but overrides my “retry” action and kills the job.

I suspect that the command “exit” is telling Batch to kill the job instead of retrying. So my question is: is “exit 25” the correct command to use in Docker to signify failure with code 25, or should I use a different command?

asked 2 years ago112 views
1 Answer

Looks like this solution actually works. I didn’t realize Batch creates a new log stream for each attempt, so I didn’t notice that the job was being retried.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions