diff --git a/docs/development/tech_docu/celery.md b/docs/development/tech_docu/celery.md index b9571170..a9b6c566 100644 --- a/docs/development/tech_docu/celery.md +++ b/docs/development/tech_docu/celery.md @@ -81,7 +81,7 @@ Example implementation for a celery chain: ```python from allianceauth.services.hooks import get_extension_logger -from celery import shared_task, chain +from celery import shared_task, group logger = get_extension_logger(__name__) @@ -98,18 +98,23 @@ def long_runner(): task_signature = example.si() my_tasks.append(task_signature) - chain(my_tasks).delay() + group(my_tasks).delay() ``` In this example, we first add 10 example tasks that need to run one after the other to a list. This can be done by creating a so-called signature for a task. Those signatures are a kind of wrapper for tasks and can be used in various ways to compose work flow for tasks. The list of task signatures is then converted to a chain and started asynchronously. +:::{note} +In this example we import group to execute all tasks independently. +If you wish to run them in order (and stop if a tasks fail) you can use `celery.chain` instead of `celery.group` + +For more information on signature and work flows see the official documentation on [Canvas](https://docs.celeryproject.org/en/latest/userguide/canvas.html). +::: + :::{hint} In our example we use ``si()``, which is a shortcut for "immutable signatures" and prevents us from having to deal with result sharing between tasks. -For more information on signature and work flows see the official documentation on `Canvas `_. - In this context, please note that Alliance Auth currently only supports chaining because all other variants require a so-called results back, which Alliance Auth does not have. :::