Answer the question
In order to leave comments, you need to log in
How to make celery retry through passing arguments?
I have a task to run celery tasks with different retry arguments, who can tell me how this can be implemented?
Here is a sample of the code to test:
from celery import Celery
app = Celery('tasks', broker='amqp://[email protected]//')
import celery
class RetryCeleryWorker(celery.Task):
autoretry_for = (Exception,)
retry_backoff = True
retry_backoff_max = 700
retry_jitter = False
@app.task(base=RetryCeleryWorker)
def add():
print('add starting')
0/0
print('add finish')
from tasks import add, app, RetryCeleryWorker
add.apply_async(retry=True, retry_policy={
'max_retries': 5,
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question