Diagrams¶
Background diagram of framework connections¶
sequenceDiagram
autonumber
participant QueueTasks
participant Starter
participant Worker
participant Broker
participant Storage
participant GlobalConfig
QueueTasks->>Starter: Initialization / configuration
Starter->>Worker: Start
Starter->>Broker: Start
Broker->>Storage: Initialization / start
Storage->>GlobalConfig: Initialization (if any)
GlobalConfig-->>Storage: Stop
Storage-->>Broker: Stop
Broker-->>Worker: Stop
Starter-->>QueueTasks: Termination
This diagram shows the relationship between components and the correct startup order:
- Starter starts only Worker and Broker.
- Broker starts Storage.
- Storage starts GlobalConfig, if present.
- Shutdown occurs in reverse order.
Task processing by the server¶
sequenceDiagram
autonumber
participant Storage
participant Broker
participant Worker
participant TaskExecutor
Broker->>Storage: Save new task
Broker->>Worker: Transfer task
Worker->>TaskExecutor: Execute task
TaskExecutor-->>Worker: Execution result
Worker->>Storage: Save result
This diagram reflects the actual process:
- The task is saved in Storage.
- The broker transfers the task to the worker.
- Worker calls TaskExecutor — a replaceable task execution component.
- TaskExecutor executes the task function, calls middlewares_before/middlewares_after, handles errors and retries.
- The result is transferred to the worker and saved in Storage.
Task creation by the client¶
sequenceDiagram
autonumber
participant AT as (A)syncTask.add_task()
participant QT as QueueTasks.add_task()
participant Broker
AT->>QT: Preparing task parameters
QT->>Broker: Registering a new task
The process looks like this:
(A)syncTask.add_task()orTaskCls().__call__().add_task()prepares the parameters.- Internally, everything is translated to
QueueTasks.add_task(). - The broker accepts the task and saves it via Storage.
Receiving the task result by the client¶
sequenceDiagram
autonumber
participant AT as (A)syncTask.add_task()
participant AR as (A)syncResult.result()
participant QT as QueueTasks
participant Broker
participant Storage
AT->>AR: Create result object
AR->>QT: Request result
QT->>Broker: Proxy request
Broker->>Storage: Read result
Storage-->>Broker: Data
Broker-->>QT: Result
QT-->>AR: Return result
Steps:
(A)syncTask.add_task()creates(A)syncResult.(A)syncResult.result()callsQueueTasks, which proxies the request.QueueTasks.get()is redirected toBroker.get().- Broker requests data from Storage.
- Storage returns the result.
- The result is sent back through Broker → QueueTasks → (A)syncResult.