graph LR
Asynchronous_Callback_Orchestrator["Asynchronous Callback Orchestrator"]
Backend_Manager_Provider["Backend Manager Provider"]
Celery_Task_Manager["Celery Task Manager"]
Diskcache_Task_Manager["Diskcache Task Manager"]
Background_Task_Registrar["Background Task Registrar"]
Asynchronous_Callback_Dispatcher["Asynchronous Callback Dispatcher"]
Asynchronous_Callback_Dispatcher -- "triggers" --> Asynchronous_Callback_Orchestrator
Asynchronous_Callback_Orchestrator -- "relies on" --> Backend_Manager_Provider
Backend_Manager_Provider -- "provides" --> Celery_Task_Manager
Backend_Manager_Provider -- "provides" --> Diskcache_Task_Manager
Celery_Task_Manager -- "leverages" --> Background_Task_Registrar
Diskcache_Task_Manager -- "leverages" --> Background_Task_Registrar
The Asynchronous Task Queue (Backend - Optional/Enterprise) subsystem in Dash provides a mechanism to offload long-running or resource-intensive callback tasks to a separate background process, enhancing application responsiveness and scalability, particularly in enterprise deployments.
This is the central component responsible for defining, setting up, monitoring, and updating the status of background callbacks. It exposes the background_callback decorator as the primary API for users to mark functions for asynchronous execution. It manages the overall lifecycle of a background task, from initial submission to result retrieval and progress updates.
Related Classes/Methods:
dash._callback.background_callbackdash._callback._setup_background_callback:371-417dash._callback._update_background_callback:433-448
Acts as an abstraction layer to dynamically retrieve the appropriate background task manager instance (e.g., Celery or Diskcache) based on the application's configuration. This component decouples the core callback orchestration logic from the specific backend implementation, allowing for flexible backend switching without altering the orchestrator.
Related Classes/Methods:
Implements the concrete backend logic for managing asynchronous tasks using the Celery distributed task queue. It handles the submission of tasks to Celery workers, monitors their execution status, retrieves results upon completion, and manages task termination and cleanup within a distributed environment.
Related Classes/Methods:
Implements the concrete backend logic for managing asynchronous tasks using Diskcache. This manager provides similar functionalities to the Celery manager but is typically used for simpler, local background processing and for storing task state and results on disk, suitable for single-node deployments or development.
Related Classes/Methods:
Provides a common registration point for background job functions. It is utilized by both the Celery and Diskcache managers to prepare user-defined callback functions for execution by their respective backends, ensuring they are properly callable and their results can be managed within the asynchronous context.
Related Classes/Methods:
This is the high-level entry point within the main dash.Dash application that initiates the processing of asynchronous callbacks. It acts as the bridge between the core Dash application's request handling and the background callback subsystem, triggering the execution of background tasks when a relevant event occurs.
Related Classes/Methods: