I do retries with celery like in the Docs-Example:
@task()
def add(x, y):
try:
...
except Exception, exc:
add.retry(exc=exc, countdown=60) # override the default and
# retry in 1 minute
How can I increase the retry-countdown everytime the retry occurs for this job - e.g. 60 seconds, 2 minutes, 4 minutes and so on until the MaxRetriesExceeded is raised?
Since version 4.2 you can use options autoretry_for
and retry_backoff
for this purposes, for example:
@task(max_retries=10, autoretry_for=(Exception,), retry_backoff=60)
def add(x, y):
pass