BaseBackend
Base (synchronous) result backend.
Constructor
Signature
def BaseBackend()
Signature
def BaseBackend(
app: [Celery](../../app/base/celery.md?sid=celery_app_base_celery),
url: string,
serializer: string,
max_cached_results: integer
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| app | [Celery](../../app/base/celery.md?sid=celery_app_base_celery) | The Celery application instance this backend is associated with |
| url | string | The connection URL used to configure the backend storage |
| serializer | string | The name of the serialization format used for task results |
| max_cached_results | integer | The maximum number of results to keep in the local memory cache |
Methods
get_status()
def get_status(
task_id: string
) - > string
Fetches the current status of a task from the backend storage.
Parameters
| Name | Type | Description |
|---|---|---|
| task_id | string | The unique identifier of the task to query |
Returns
| Type | Description |
|---|---|
string | The state of the task, such as PENDING, SUCCESS, or FAILURE |
store_result()
def store_result(
task_id: string,
result: any,
state: string,
traceback: string,
request: object
) - > null
Persists the task result and state into the backend for later retrieval.
Parameters
| Name | Type | Description |
|---|---|---|
| task_id | string | The unique identifier of the task being updated |
| result | any | The return value or exception object to be stored |
| state | string | The state to transition the task into |
| traceback | string | The stack trace string if the task failed |
| request | object | The original task request message |
Returns
| Type | Description |
|---|---|
null | None |
wait_for()
def wait_for(
task_id: string,
timeout: float,
propagate: boolean
) - > any
Blocks until the specified task reaches a ready state or the timeout expires.
Parameters
| Name | Type | Description |
|---|---|---|
| task_id | string | The unique identifier of the task to wait for |
| timeout | float | The maximum number of seconds to wait before raising a TimeoutError |
| propagate | boolean | Whether to re-raise any exceptions that occurred during task execution |
Returns
| Type | Description |
|---|---|
any | The decoded result of the task once it is available |