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
| Attribute | Type | Description |
|---|---|---|
| settings_name | string = TASKS | The key used to look up task-related configuration settings within the application's global settings dictionary. |
| exception_class | Exception class = InvalidTaskBackend | The 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
| Name | Type | Description |
|---|---|---|
| alias | string | The unique identifier or key in the TASKS settings dictionary used to retrieve specific backend configuration. |
Returns
| Type | Description |
|---|---|
[BaseTaskBackend](backends/base/basetaskbackend.md?sid=django_tasks_backends_base_basetaskbackend) | An initialized task backend instance configured with the parameters defined in the settings. |