TaskRegistry
Map of registered tasks.
Attributes
| Attribute | Type | Description |
|---|---|---|
| NotRegistered | Exception = NotRegistered | Exception class raised when a requested task name is not found in the registry. |
Constructor
Signature
def TaskRegistry() - > null
Methods
register()
@classmethod
def register(
task: [Task](../../events/state/task.md?sid=celery_events_state_task)
) - > null
Register a task in the task registry. The task will be automatically instantiated if not already an instance. Name must be configured prior to registration.
Parameters
| Name | Type | Description |
|---|---|---|
| task | [Task](../../events/state/task.md?sid=celery_events_state_task) | The task instance or class to be added to the registry; must have a defined name attribute |
Returns
| Type | Description |
|---|---|
null | None |
unregister()
@classmethod
def unregister(
name: string|Task
) - > null
Unregister task by name.
Parameters
| Name | Type | Description |
|---|---|---|
| name | `string | Task` |
Returns
| Type | Description |
|---|---|
null | None |
regular()
@classmethod
def regular() - > dict
Filters the registry to return only tasks explicitly marked as 'regular' type.
Returns
| Type | Description |
|---|---|
dict | A dictionary mapping task names to task instances for all regular tasks |
periodic()
@classmethod
def periodic() - > dict
Filters the registry to return only tasks explicitly marked as 'periodic' type.
Returns
| Type | Description |
|---|---|
dict | A dictionary mapping task names to task instances for all periodic tasks |
filter_types()
@classmethod
def filter_types(
type: string
) - > dict
Filters the internal task map based on the specified task type attribute.
Parameters
| Name | Type | Description |
|---|---|---|
| type | string | The type string used to filter the registered tasks (e.g., 'regular' or 'periodic') |
Returns
| Type | Description |
|---|---|
dict | A dictionary containing only the tasks that match the specified type string |