Signals
Signals: hooks that run around every task, like Celery’s task_prerun & co.
Connect a receiver in a module listed in INIT_MODULES (imported once, when the
function starts) so it is registered before the first task runs:
from celery_cloud.signals import task_failure
@task_failure.connect
def report(task_id=None, task=None, exception=None, **kwargs):
...
Receivers are called with keyword arguments, so declare **kwargs: new ones may be
added. A receiver that raises is logged and ignored; it never breaks the task.
Signal |
Keyword arguments |
|---|---|
|
|
|
the above + |
|
|
|
|
|
|
- class celery_cloud.signals.Signal(name: str)[source]
Bases:
objectA list of receivers that are called with keyword arguments.
The signals
- celery_cloud.signals.task_prerun
A list of receivers that are called with keyword arguments.
- celery_cloud.signals.task_postrun
A list of receivers that are called with keyword arguments.
- celery_cloud.signals.task_success
A list of receivers that are called with keyword arguments.
- celery_cloud.signals.task_failure
A list of receivers that are called with keyword arguments.
- celery_cloud.signals.task_retry
A list of receivers that are called with keyword arguments.