kalluripradeep opened a new pull request, #68828:
URL: https://github.com/apache/airflow/pull/68828
## Summary
Fixes #66905 — `TriggerDagRunOperator` can fail with `DagRunAlreadyExists`
after an ambiguous execution-API trigger retry.
### Root cause
`Client.request()` has a tenacity `@retry` decorator that replays requests
on `httpx.RequestError` (transport-level ambiguities) and HTTP 5xx. When a
`POST dag-runs/{dag_id}/{run_id}` creates the DAG run server-side but the
response is lost, the retry receives `409 Conflict`.
`DagRunOperations.trigger()` converts that to
`ErrorResponse(DAGRUN_ALREADY_EXISTS)` and returns it to the supervisor, which
forwards it to the task runner.
Previously `_handle_trigger_dag_run` reacted to `DAGRUN_ALREADY_EXISTS` with
`skip_when_already_exists=False` (the default) by marking the parent task
**FAILED** and not writing the `trigger_run_id` XCom.
### Fix
When `DAGRUN_ALREADY_EXISTS` is received and
`skip_when_already_exists=False`, the requested `run_id` already exists — which
is the desired end state. Instead of failing, log an info message and fall
through to the normal success path: push the `trigger_run_id` XCom and honour
`wait_for_completion`.
The `skip_when_already_exists=True` branch is **unchanged** — it still
returns `SKIPPED` immediately.
### Changes
| File | Change |
|------|--------|
| `task-sdk/src/airflow/sdk/execution_time/task_runner.py` |
`_handle_trigger_dag_run`: change `else` branch from FAIL to
fall-through-to-success |
| `task-sdk/tests/task_sdk/execution_time/test_task_runner.py` | Update
parametrize `(False, FAILED)→(False, SUCCESS)`; add dedicated transport-retry
regression test |
### Testing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]