I am using Cloud Task to trigger a Cloud Run Job, and I would like it to automatically retry running the job at a later time whenever the job execution fails. However, what I am observing is that Cloud Task does not retry upon Cloud Run Job failures. Is there a trick to make it work?
You can Set retry parameters. If a task does not complete successfully, then Cloud Tasks will retry the task depending on the parameters you have set. You can specify the maximum number of tries, set a time limit for a retry attempt, and control interval between attempts.
Additionally, you can also set the maximum retries for Cloud Run jobs. The default number of tries for a task to restart in case of a failure is 3.
Thank you @Marramirez . We do have the retry parameters set. However, Cloud Task cannot tell when a Cloud Run Job fails and does not actually retry, despite having set the retry parameters.
To signal a Cloud Run Job failure, I just throw an exception in my code. In the Cloud Run dashboard, I do see my failed jobs as expected. However, Cloud Task would not retry running the failed jobs.
I have considered setting the retry options of the Cloud Run Job itself. However, there is not an option for retrying after X minutes. Keeping the job running and retrying immediately over and over again would be too costly for me.