Uh oh!
There was an error while loading. Please reload this page.
Fix DagRun.dag_versions after partial run_on_latest_version clear - #71459
Open
dgvj-work wants to merge 2 commits into
Open
Fix DagRun.dag_versions after partial run_on_latest_version clear#71459dgvj-work wants to merge 2 commits into
dgvj-work wants to merge 2 commits into
Conversation
Stop special-casing bundle-versioned runs through created_dag_version_id. Always derive versions from the run's TaskInstance / history rows so mixed versions after a partial clear are reported correctly. Closesapache#71454 Signed-off-by: Digvijay <digvijay.vaghela@yahoo.com>
attach_dag_versions_to_runs previously skipped runs with bundle_version, assuming dag_versions used created_dag_version. After removing that shortcut, prefetch all runs so Grid/UI keeps the lightweight path and still sees mixed TI versions. Signed-off-by: Digvijay <digvijay.vaghela@yahoo.com>
dgvj-work
requested review from
XD-DENG, ashb, bugraoz93, choo121600, ephraimbuddy, henry3260, jason810496, pierrejeambrun, rawwar and shubhamraj-git
as code ownersAugust 11, 2026 19:42
Member
There was a problem hiding this comment.
We also have #71425 to address the same issue.
Edit: #71425 isn't solving that issue.
@ephraimbuddy@dstandish wdyt?
This doesn't solve the contract problem mentioned in the other PR but can help sove the immediate reported issues with minimal effort. While we figure out the interface we want.
pierrejeambrun
approved these changes
Aug 27, 2026
pierrejeambrun
left a comment
Member
There was a problem hiding this comment.
A few nits, looking good to me.
Comment on lines
+1394
to
+1396
| Repro for apache/airflow#71454: clearing a subset with run_on_latest_version=True bumps | ||
| created_dag_version_id / bundle_version to latest while uncleared TIs stay on the old | ||
| version. The property must report both. |
There was a problem hiding this comment.
Suggested change
| Reproforapache/airflow#71454: clearing a subset with run_on_latest_version=True bumps | |
| created_dag_version_id/bundle_versiontolatestwhileunclearedTIsstayontheold | |
| version. Thepropertymustreportboth. |
There was a problem hiding this comment.
We do not specify issues number in tests.
| assert {dv.id for dv in versions} == ti_version_ids | ||
| assert None not in versions | ||
| def test_dag_run_dag_versions_after_partial_run_on_latest_version(self, dag_maker, session): |
There was a problem hiding this comment.
Metion bundled version in the test name and docstring I guess
Comment on lines
+535
to
+537
| # Always derive from actual TI/TIH versions. Do not special-case bundle-versioned | ||
| # runs via created_dag_version_id: clear(..., run_on_latest_version=True) can bump | ||
| # that pointer while leaving uncleared TIs on older versions (apache/airflow#71454). |
There was a problem hiding this comment.
Suggested change
| # Always derive from actual TI/TIH versions. Do not special-case bundle-versioned | |
| # runs via created_dag_version_id: clear(..., run_on_latest_version=True) can bump | |
| # that pointer while leaving uncleared TIs on older versions (apache/airflow#71454). | |
| # Always derive from actual TI/TIH versions. |
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
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix
DagRun.dag_versionssilently dropping older versions still in use after a partialrun_on_latest_versionclear.For bundle-versioned runs the property previously returned only
created_dag_version. Clearing a subset withrun_on_latest_version=Truebumps that pointer to latest while uncleared TaskInstances keep their olderdag_version_id, so the Grid UI could show a single version chip while tasks were still executing under mixed versions.Changes
DagRun.dag_versionsfrom the run's TaskInstance / TaskInstanceHistory rows (same path as unpinned runs).attach_dag_versions_to_runsto prefetch for bundle-versioned runs as well, so Grid/UI keeps the lightweight DISTINCT query path and still sees mixed versions.closes: #71454
Testing
uv run --project airflow-core pytest airflow-core/tests/unit/models/test_dagrun.py::TestDagRun::test_dag_run_dag_versions_method airflow-core/tests/unit/models/test_dagrun.py::TestDagRun::test_dag_run_dag_versions_with_null_created_dag_version airflow-core/tests/unit/models/test_dagrun.py::TestDagRun::test_dag_run_dag_versions_after_partial_run_on_latest_version -qWas generative AI tooling used to co-author this PR?