Skip to main content

trace_task_ret

Traces the execution of a task by decoding the message body, updating the request context with metadata, and executing the task within the application's task registry.

def trace_task_ret(
name: string,
uuid: string,
request: dict,
body: any,
content_type: string,
content_encoding: string,
loads: callable = loads_message,
app: Celery = null,
extra_request: dict
) - > tuple

Traces the execution of a task by decoding the message body and executing the task within a trace context.

Parameters

NameTypeDescription
namestringThe registered name of the task to be executed.
uuidstringThe unique identifier for the specific task instance.
requestdictThe request context dictionary to be updated with task arguments and metadata.
bodyanyThe raw message body containing task arguments, which may be serialized or a pre-parsed tuple.
content_typestringThe MIME type of the message body used to determine the appropriate deserialization method.
content_encodingstringThe character encoding of the message body.
loadscallable = loads_messageThe deserialization function used to decode the message body into Python objects.
appCelery = nullThe Celery application instance; defaults to the current application context if not provided.
extra_requestdictAdditional keyword arguments to be merged into the task request context.

Returns

TypeDescription
tupleA tuple containing the execution status (1 for success, 0 for failure), the task result or traceback string, and the runtime duration.