Answer the question
In order to leave comments, you need to log in
Is it possible to call a task in a chain with a parameterized max_retries option?
You need to perform the same task in different chains with different behavior. For chain A , I want to limit the number of restarts, so I specify this parameter when declaring the task itself
@shared_task(bind=True, max_retries=1)
task(args):
pass
chain(task.s(args).set(max_retries=None), task2...)
something does not work =( You can't define options with s(), but a chaining set call takes care of that ( link )
The maximum number of attempted retries before giving up. If the number of retries exceeds this value a MaxRetriesExceededError exception will be raised.
The default is 3. A value of None will disable the retry limit and the task will retry forever until it succeeds.
Answer the question
In order to leave comments, you need to log in
Signature initialization option without shortcuts:
The problem is that None somewhere inside means "not set" and defaults to the default 3 repetitions. In any case, this was the case in the days of 3.1. We modify task.request.retries inside for infinite repetitions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question