Skip to main content

TaskRegistry

Map of registered tasks.

Attributes​

AttributeTypeDescription
NotRegisteredException = NotRegisteredException 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​

NameTypeDescription
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​

TypeDescription
nullNone

unregister()​

@classmethod
def unregister(
name: string|Task
) - > null

Unregister task by name.

Parameters​

NameTypeDescription
name`stringTask`

Returns​

TypeDescription
nullNone

regular()​

@classmethod
def regular() - > dict

Filters the registry to return only tasks explicitly marked as 'regular' type.

Returns​

TypeDescription
dictA 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​

TypeDescription
dictA 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​

NameTypeDescription
typestringThe type string used to filter the registered tasks (e.g., 'regular' or 'periodic')

Returns​

TypeDescription
dictA dictionary containing only the tasks that match the specified type string