celery
Updated celery configuration.
patch_celery()
Patch redis backend so that errors in chords don't break workflows. Celery has error callbacks but they do not work properly on chords that are nested within chains.
Credit to this function goes to the following post.
Source code in merlin/celery.py
route_for_task(name, args, kwargs, options, task=None, **kw)
Custom task router for Celery queues.
This function routes tasks to specific queues based on the task name. If the task name contains a colon, it splits the name to determine the queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the task being routed. |
required |
args
|
List[Any]
|
The positional arguments passed to the task. |
required |
kwargs
|
Dict[Any, Any]
|
The keyword arguments passed to the task. |
required |
options
|
Dict[Any, Any]
|
Additional options for the task. |
required |
task
|
Task
|
The task instance (default is None). |
None
|
**kw
|
Dict[Any, Any]
|
Additional keyword arguments for THIS function (not the task). |
{}
|
Returns:
| Type | Description |
|---|---|
Dict[Any, Any]
|
A dictionary specifying the queue to route the task to. If the task name contains a colon, it returns a dictionary with the key "queue" set to the queue name. Otherwise, it returns an empty dictionary. |
Example
Using a colon in the name will return the string before the colon as the queue:
Source code in merlin/celery.py
setup(**kwargs)
Set affinity for the worker on startup (works on toss3 nodes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Dict[Any, Any]
|
Keyword arguments. |
{}
|