Skip to main content

TaskBackendHandler

This class manages the lifecycle and configuration of task backend connections by mapping settings aliases to specific backend implementations. It dynamically imports backend classes based on provided configuration and handles the instantiation of these backends with their respective parameters. The handler also provides specialized exception management for invalid backend configurations.

Attributes

AttributeTypeDescription
settings_namestring = TASKSThe key used to look up task-related configuration settings within the application's global settings dictionary.
exception_classException class = InvalidTaskBackendThe specific exception type raised when a requested task backend cannot be found or imported correctly.

Methods


create_connection()

@classmethod
def create_connection(
alias: string
) - > [BaseTaskBackend](backends/base/basetaskbackend.md?sid=django_tasks_backends_base_basetaskbackend)

Instantiates and returns a task backend instance based on the configuration settings for the specified alias.

Parameters

NameTypeDescription
aliasstringThe unique identifier or key in the TASKS settings dictionary used to retrieve specific backend configuration.

Returns

TypeDescription
[BaseTaskBackend](backends/base/basetaskbackend.md?sid=django_tasks_backends_base_basetaskbackend)An initialized task backend instance configured with the parameters defined in the settings.