Deferrable HttpOperator¶
HttpOperator can run in deferrable mode
(deferrable=True, or via [operators] default_deferrable). In that mode the operator
defers immediately and the HTTP request is executed in the Triggerer by
HttpTrigger.
Triggerer restart can replay the request¶
The Triggerer persists trigger kwargs and reconstructs the trigger after a restart.
HttpTrigger.run() then issues the HTTP request again. That is safe for
idempotent methods and unsafe for methods that create a new side effect on every
call (the operator default is POST).
HttpOperator treats these methods as idempotent, matching RFC 9110 §9.2.2:
GETHEADOPTIONSPUTDELETETRACE
POST, PATCH, and any other method emit one task-log warning per attempt
when used with deferrable mode.
Silencing the warning¶
If a duplicate request is acceptable for your endpoint, set
warn_on_non_idempotent=False:
HttpOperator(
task_id="create_resource",
method="POST",
endpoint="/resources",
deferrable=True,
warn_on_non_idempotent=False,
)
Safer alternatives for polling or waiting on an HTTP condition are
HttpSensor or an event-driven
trigger such as HttpEventTrigger.
For a one-shot non-idempotent call, prefer deferrable=False so the worker
issues the request once.
This page is the target of the task-log warning. The warning does not prevent a duplicate request; it only tells Dag authors that a Triggerer restart can replay it.