Skip to main content

second_order_replace1

Executes a Celery task that pushes a status message to Redis and conditionally replaces itself with a task chain consisting of second_order_replace2 and a recursive call to second_order_replace1 with an updated state.

def second_order_replace1(
self: celery.app.task.Task,
state: boolean = False
) - > null

Executes a two-phase task sequence that logs state transitions to Redis and recursively replaces itself with a chained execution of second_order_replace2.

Parameters

NameTypeDescription
selfcelery.app.task.TaskThe Celery task instance, used to access the replace method for dynamic workflow modification.
stateboolean = FalseA toggle determining the execution phase; False triggers the task chain replacement, while True logs the completion phase.

Returns

TypeDescription
nullThis function raises a TaskReplacement exception to trigger Celery task replacement and does not return a value.