I have a task:
@celery.task(name='request_task',default_retry_delay=2,acks_late=True)
def request_task(data):
try:
if some_condition:
request_task.retry()
except Exception as e:
request_task.retry()
I use celery with mongodb broker and mongodb results backend enabled.
When task's retry() method is called, neither from conditional statement nor after catching exception, the task is not retried.
in the worker's terminal I get message like this:
[2012-08-10 19:21:54,909: INFO/MainProcess] Task request_task[badb3131-8964-41b5-90a7-245a8131e68d] retry: Task can be retried
What can be wrong?
UPDATE: Finally, I did not solve this question and had to use while loop inside the task, so my tasks never get retried.
I have a task:
@celery.task(name='request_task',default_retry_delay=2,acks_late=True)
def request_task(data):
try:
if some_condition:
request_task.retry()
except Exception as e:
request_task.retry()
I use celery with mongodb broker and mongodb results backend enabled.
When task's retry() method is called, neither from conditional statement nor after catching exception, the task is not retried.
in the worker's terminal I get message like this:
[2012-08-10 19:21:54,909: INFO/MainProcess] Task request_task[badb3131-8964-41b5-90a7-245a8131e68d] retry: Task can be retried
What can be wrong?
UPDATE: Finally, I did not solve this question and had to use while loop inside the task, so my tasks never get retried.
0 commentaires:
Enregistrer un commentaire