Reputation: 27
We have multiple shared tasks in our django codebase that fetch data from db and manipulate. Is it possible to include a celery configuration that retries "all" failed tasks rather than adding "try-catch" in each individual task
Upvotes: 0
Views: 414
Reputation: 909
Consider using autoretry_for
option, see celery docs
UPD.
It could be more convenient not to provide the option for every task once you have specified it. Unfortunatelly at the time autoretry_for
could only be passed as the task decorator argument, but there is a functional approach to do the trick
from functools import partial
from celery import shared_task
shared_task = partial(shared_task, autoretry_for=(RuntimeError,))))
Upvotes: 1