-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Open
Labels
kind:featureFeature RequestsFeature Requests
Description
Description
I propose an enhancement to TriggerDagRunOperator that would allow automatic clearing of failed task instances in a triggered DAG run if that DAG run previously failed.
Use case/motivation
When using TriggerDagRunOperator in synchronous mode (i.e., wait_for_completion=True), if the triggered child DAG fails (due to a failed task), the parent task also fails. However, when the operator is cleared in the UI (e.g., to retry), the associated failed child DAG run remains unchanged.
As a result:
- The retried TriggerDagRunOperator reuses the same failed DAG run,
- The child DAG run is still in failed state → the operator fails again,
- The user must manually clear failed tasks or the entire child DAG run.
This creates unnecessary friction when using DAG chaining.
Proposed solution:
Introduce a new optional parameter:
TriggerDagRunOperator(
...,
auto_clear_failed_tasks=True
)
When set:
- Upon execution (or possibly in the clear() method logic),
- If a matching child DAG run exists and is in failed state,
- All failed task instances (and optionally downstreams) in that DAG run are automatically cleared.
This enables retrying the parent task to also retry the corresponding child DAG.
Benefits
- Smoother reprocessing of chained DAGs
- Reduces manual intervention
- Fits naturally with Airflow's existing retry model
Related issues
No response
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
kind:featureFeature RequestsFeature Requests