Skip to content

[v3-3-test] Reduce per-task DB round trips in the asset dependency graph API (#71915) - #72737

Closed
vatsrahul1001 wants to merge 1 commit into
v3-3-testfrom
backport-a3b5b0be78-v3-3-test
Closed

vatsrahul1001 wants to merge 1 commit into
v3-3-testfrom
backport-a3b5b0be78-v3-3-test

Conversation

@vatsrahul1001

Copy link
Copy Markdown
Contributor

Backport of #71915 to v3-3-test for the Airflow 3.3.2 patch release.

This is an adaptation, not a straight cherry-pick. #71915 was written on top of #69833 ("Consolidate UI Dependency Graphs", a 29-file refactor that is not backported), so its diff doesn't apply to v3-3-test's older dependency-graph function. v3-3-test has the same N+1 pattern (a TaskInletAssetReference/TaskOutletAssetReference query per task, inside the producing/consuming loops), so I applied the same optimization to it: collect the task keys for the current asset and resolve inlets/outlets in a single batched tuple_(...).in_(...) query.

Behaviour is unchanged — all 26 tests in test_dependencies.py pass locally.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

)

Adapted from #71915 to v3-3-test's dependency-graph BFS (its function predates
the #69833 refactor, so the original diff does not cherry-pick). Same optimization:
collect all producing/consuming task keys for the current asset and resolve the
inlet/outlet references in a single batched tuple_().in_() query instead of one
query per task. Behaviour is unchanged; the 26 dependency tests pass.
@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Sep 8, 2026
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.3.2 milestone Sep 8, 2026
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends heavily on a rewrite that wasn't backported.

I would mark this for 3.4 too.

@vatsrahul1001

Copy link
Copy Markdown
Contributor Author

Closing backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants