-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
[AIRFLOW-5500] Fix the trigger_dag api in the case of nested subdags #8081
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
@cBournhonesque Wanted to understand why all nested subdags are stored in dag.subdags level, |
@Devarajegowda I think it would make sense to only have dags.subdags have the 1st level of subdags; but I thought that maybe this choice was made for a specific reason? |
Yes even I believe so, if we make those changes change in this commit may not be needed at all. |
It seems like one side-effect is that clicking on 'clear tasks recursive' on the UI only clears the tasks of the direct subdags, not all nested subdags. |
I've run into this issue too.. Looking at places
Clearly DAG.subdags was intended to return all subdags and nested subdags, so I think fixing trigger_dag to respect that behaviour is the right way to go |
Actually, I think so too. Changing dag.subdags directly also change the behaviour of clearing a dag recursively in the UI. |
Really hope this can be merged into 1.10.11, very important for our tasks. |
I think that one neds some better understanding about consequences of subdag triggering - it looks legit for me (and I marked it for 1.10.11) but maybe others @kaxil? @milton0825 can have a look and see if there is no problem with it. It's rather small change. |
Can you rebase on latest master please @cBournhonesque |
@kaxil Thanks, I just did. |
Awesome work, congrats on your first merged pull request! |
Like the jira issue states (https://issues.apache.org/jira/browse/AIRFLOW-5500), the experimental api is broken when one tries to trigger a dag that contains nested subdags.
The reason for this is that calling
dag.subdags
returns a list of ALL the subdags for the dag (even the nested ones), instead of the direct child subdags.(here: https://github.com/apache/airflow/blob/master/airflow/models/dag.py#L756)
My fix directly changes the trigger_dag.py, but a better solution is probably to make
dag.subdags
return only the child subdags. I didn't know if the current behaviour was chosen for a specific reason so I decided to just change the experimental api.Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.