-
Notifications
You must be signed in to change notification settings - Fork 16.4k
AIP-72: Get TriggerDagRunOperator working with Task SDK
#47882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5abb904 to
64e1cea
Compare
ashb
reviewed
Mar 18, 2025
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py
Show resolved
Hide resolved
ashb
reviewed
Mar 18, 2025
ashb
approved these changes
Mar 18, 2025
Member
ashb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like an okay approach given the current constraints.
64e1cea to
e783d58
Compare
b431db5 to
97f0e64
Compare
closes apache#47499 `TriggerDagRunOperator` requires direct DB access to trigger DAG runs, which is not feasible under AIP-72 / Task SDK. Several approaches were considered: 1. **New Airflow API provider** - Move `TriggerDagRunOperator` to a new provider built on top of the HTTP provider and Airflow API. - This would allow DAG authors to configure a dedicated Airflow connection. - However, the Public API currently requires API tokens and does not support username/password authentication, making setup cumbersome. 2. **Pass Task Token to API** - Use Task Token from the controller DAG to authenticate API calls. - This would allow triggering DAGs in the same deployment using the execution API. - However, Task-identity tokens have not been implemented yet. 3. **Handle via Task Execution API (Chosen Approach)** - Raise a `TriggerDagRunOperator` exception. - The Task Runner catches this and invokes a new endpoint in the Task Execution API to trigger the target DAG. Since (2) is not yet available, this PR/commit implements (3) as a temporary solution.
97f0e64 to
9e46306
Compare
This was referenced Mar 19, 2025
agupta01
pushed a commit
to agupta01/airflow
that referenced
this pull request
Mar 21, 2025
closes apache#47499 `TriggerDagRunOperator` requires direct DB access to trigger DAG runs, which is not feasible under AIP-72 / Task SDK. Several approaches were considered: 1. **New Airflow API provider** - Move `TriggerDagRunOperator` to a new provider built on top of the HTTP provider and Airflow API. - This would allow DAG authors to configure a dedicated Airflow connection. - However, the Public API currently requires API tokens and does not support username/password authentication, making setup cumbersome. 2. **Pass Task Token to API** - Use Task Token from the controller DAG to authenticate API calls. - This would allow triggering DAGs in the same deployment using the execution API. - However, Task-identity tokens have not been implemented yet. 3. **Handle via Task Execution API (Chosen Approach)** - Raise a `TriggerDagRunOperator` exception. - The Task Runner catches this and invokes a new endpoint in the Task Execution API to trigger the target DAG. Since (2) is not yet available, this PR/commit implements (3) as a temporary solution.
shubham-pyc
pushed a commit
to shubham-pyc/airflow
that referenced
this pull request
Mar 22, 2025
closes apache#47499 `TriggerDagRunOperator` requires direct DB access to trigger DAG runs, which is not feasible under AIP-72 / Task SDK. Several approaches were considered: 1. **New Airflow API provider** - Move `TriggerDagRunOperator` to a new provider built on top of the HTTP provider and Airflow API. - This would allow DAG authors to configure a dedicated Airflow connection. - However, the Public API currently requires API tokens and does not support username/password authentication, making setup cumbersome. 2. **Pass Task Token to API** - Use Task Token from the controller DAG to authenticate API calls. - This would allow triggering DAGs in the same deployment using the execution API. - However, Task-identity tokens have not been implemented yet. 3. **Handle via Task Execution API (Chosen Approach)** - Raise a `TriggerDagRunOperator` exception. - The Task Runner catches this and invokes a new endpoint in the Task Execution API to trigger the target DAG. Since (2) is not yet available, this PR/commit implements (3) as a temporary solution.
nailo2c
pushed a commit
to nailo2c/airflow
that referenced
this pull request
Apr 4, 2025
closes apache#47499 `TriggerDagRunOperator` requires direct DB access to trigger DAG runs, which is not feasible under AIP-72 / Task SDK. Several approaches were considered: 1. **New Airflow API provider** - Move `TriggerDagRunOperator` to a new provider built on top of the HTTP provider and Airflow API. - This would allow DAG authors to configure a dedicated Airflow connection. - However, the Public API currently requires API tokens and does not support username/password authentication, making setup cumbersome. 2. **Pass Task Token to API** - Use Task Token from the controller DAG to authenticate API calls. - This would allow triggering DAGs in the same deployment using the execution API. - However, Task-identity tokens have not been implemented yet. 3. **Handle via Task Execution API (Chosen Approach)** - Raise a `TriggerDagRunOperator` exception. - The Task Runner catches this and invokes a new endpoint in the Task Execution API to trigger the target DAG. Since (2) is not yet available, this PR/commit implements (3) as a temporary solution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #47499
TriggerDagRunOperatorrequires direct DB access to trigger DAG runs, which is not feasible under AIP-72 / Task SDK. Several approaches were considered:New Airflow API provider
TriggerDagRunOperatorto a new provider built on top of the HTTP provider and Airflow API.Pass Task Token to API
Handle via Task Execution API (Chosen Approach)
TriggerDagRunOperatorexception.Since (2) is not yet available, this PR/commit implements (3) as a temporary solution.
Triggering in Action:
Waiting for completion:

Skip when already exists:

Extra Operator Link:

TODO:
Will tackle in future PR as this is already big:
TriggerDagRunOperatorwith Task SDK #47949)Finding:
TriggerDagRunOperatortests were never migrated to the standard provider — even though the operator code was. It means we never testedTriggerDagRunOperator(from Standard provider) on AF 2.x -- so a lot of tests are now broken .Example Run: https://github.com/apache/airflow/actions/runs/13933237043/job/38995945264?pr=47882