1

i am trying to do some error handling in a celery workflow containing groups and chains. The following example code describes the situation:

from .tasks import task_1, task_2, task_3, task_4, task_finalize, handle_error

chain_1 = (task_1 | task_2)
chain_2 = (task_1 | task_2)

finalize_group = group([task_finalize, task_finalize])

group_of_chains = group([chain_1, chain_2])

# Definition of the final workflow
workflow = (chord(group_of_chains, task_3.on_error(handle_error)) | task_4 | finalize_group)

I only want to handle the first raised exception in "group_of_chains". According to the official celery docs here, i have to use the on_error() method of the chord body (task_3), but handle_error is not executed at all. Any idea what i am missing?

Smie85
  • 21
  • 3
  • Could it be something as simple as your task_3 does not actually throw an error? – DejanLekic Jul 31 '19 at 08:03
  • What does your `handle_error` look like? And could you simplify your workflow to have a minimal example with the same problem? – Lotram Jul 31 '19 at 08:35
  • unfortunatly this is the simplest example to reproduce the behavior. What i found out so far is that it seems to work, when i do the following: ```python workflow = (chord(group_of_chains, (task_3 | task_4).on_error(handle_error)) | finalize_group) ``` – Smie85 Jul 31 '19 at 08:41

0 Answers0