Skip to content
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

Bug fix fetch_callback of Partial Subset DAG #35256

Merged
merged 3 commits into from Nov 6, 2023

Conversation

syun64
Copy link
Contributor

@syun64 syun64 commented Oct 29, 2023

I believe that there may be a bug where if a partial_subset dag is generated on a DAG with on_success_callback or on_failure_callback functions defined on it, then it might try to look for a TI that is not actually a part of the partial subset DAG. This is because we fetch the last TI available from the DagRun within DAG.fetch_callback, and a DagRun isn't aware of the concept of a partial subset. Hence ti.task = dag.get_task(ti.task_id) results in a TaskNotFound exception.

In this PR, we are:

  1. Adding DAG callback functions to the test DAG defined in tests/jobs/test_backfill_job.py::TestBackfillJob::test_sub_set_subdag to cover this test case (which fails without below patch)
  2. If dag.partial, we filter out tis where ti.state == State.NONE within DAG.fetch_callback

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added the area:Scheduler Scheduler or dag parsing Issues label Oct 29, 2023
airflow/models/dag.py Outdated Show resolved Hide resolved
@syun64
Copy link
Contributor Author

syun64 commented Nov 6, 2023

Thank you for the review @vincbeck . Would you be able to merge this in? Unfortunately I do not have write access to the repository

@vincbeck vincbeck merged commit d78c6f3 into apache:main Nov 6, 2023
43 checks passed
@vincbeck
Copy link
Contributor

vincbeck commented Nov 6, 2023

Done! Thanks for the PR!

romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Nov 10, 2023
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Nov 20, 2023
@ephraimbuddy ephraimbuddy added this to the Airflow 2.8.0 milestone Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Scheduler Scheduler or dag parsing Issues type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants