Skip to main content

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​

NameTypeDescription
app[Celery](../../app/base/celery.md?sid=celery_app_base_celery)The Celery application instance this backend is associated with
urlstringThe connection URL used to configure the backend storage
serializerstringThe name of the serialization format used for task results
max_cached_resultsintegerThe 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​

NameTypeDescription
task_idstringThe unique identifier of the task to query

Returns​

TypeDescription
stringThe 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​

NameTypeDescription
task_idstringThe unique identifier of the task being updated
resultanyThe return value or exception object to be stored
statestringThe state to transition the task into
tracebackstringThe stack trace string if the task failed
requestobjectThe original task request message

Returns​

TypeDescription
nullNone

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​

NameTypeDescription
task_idstringThe unique identifier of the task to wait for
timeoutfloatThe maximum number of seconds to wait before raising a TimeoutError
propagatebooleanWhether to re-raise any exceptions that occurred during task execution

Returns​

TypeDescription
anyThe decoded result of the task once it is available