Celery retry. Possible BUG?

38 views
Skip to first unread message

Tirty

unread,
May 29, 2020, 10:43:42 AM5/29/20
to celery-users

Doing:
self.retry(exc=Exception("not_available"), args=[output_port, start_date, end_date, order_id], kwargs=kwargs, countdown=10)
celery just split the task, will retry the current one and will create a new one.
Now, why this happens? Cause the first time the task is called has parameters in "kwargs" and get unpacked in function parameters. Calling self.retry some "kwargs" are still there but others are moved in function parameters, so Celery retry seems just to be a "Override this task making an equal task" function...so you get 2 tasks:

  1. The one that no one will override (cause retry will never hit that cause kwargs and args changed)
  2. The one made "new" trying to override (with "new" args and kwargs)

def execute(self, output_port, start_date, end_date, order_id=None, **kwargs):
This is my task function, as i said, parameters are passed through "kwargs" that unpack them on "same name" function parameters.

EDIT:
forget to say, in retry i updated the parameter "order_id" once (first time), so i need to retry with a filled order_id(first time is None).
So i get a task with order_id=None and a task with order_id="Filled_value".

Reply all
Reply to author
Forward
0 new messages