vatsrahul1001 opened a new pull request, #66982:
URL: https://github.com/apache/airflow/pull/66982
Cherry-pick of #64034 for the Airflow 3.2.2 patch release.
Previously parked because it conflicted with v3-2-test's `dag_bag`-based
`_build_ti_summaries` shape (introduced by #65966 backport —
`_get_serdag(dag_bag, ...)` returns `SerializedDAG`, while #64034 was written
when it returned `SerializedDagModel`). Manually resolved to keep v3-2-test's
`dag_bag` plumbing while adopting #64034's payload improvements.
### Conflict resolution
Six conflict regions in
`airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py`:
1. **Imports (line 28):** dropped `selectinload` — auto-merge of
`get_grid_runs` removed all its usages.
2. **Imports (line 73):** dropped `TaskInstanceHistory` (no longer used);
kept `create_session` (needed for per-yield session pattern) and
`TYPE_CHECKING` block (`DBDagBag`, `SerializedDAG`).
3. **`_build_ti_summaries` signature:** kept v3-2-test's `dag_bag: DBDagBag`
parameter (essential — `_get_serdag` on this branch already takes `dag_bag` for
caching across requests). Adopted `ti_details: dict[str, GridNodeAgg] = {}` and
the `dag_version_id` accumulator from #64034 instead of `defaultdict(list)`.
4. **Serdag resolution:** kept v3-2-test's `_get_serdag(dag_bag, dag_id,
dag_version_id, session)` call. Adopted #64034's `if not ti_details: return
None` early-out. Dropped `serdag_cache` — `dag_bag` already provides
cross-request caching (better than per-call `serdag_cache`).
5. **`_find_aggregates` call:** adopted `(node, _)` tuple unpacking (the
auto-merged `services/ui/grid.py` now returns `Iterable[tuple[dict,
GridNodeAgg]]`). Kept v3-2-test's `serdag.task_group` access (vs. PR's
`serdag.dag.task_group`) since on this branch `_get_serdag` returns
`SerializedDAG`, not `SerializedDagModel`.
6. **`_generate()` body:** kept v3-2-test's per-yield `with
create_session(scoped=False) as session:` pattern (important DB connection
cleanup, see issue #65010). Added #64034's `.execution_options(yield_per=1000)`
for streaming. Dropped `serdag_cache` — `dag_bag` already covers it.
Auto-merged into the backport via #65966 already on v3-2-test:
- `services/ui/grid.py` — `GridNodeAgg` dataclass + `_find_aggregates` tuple
return.
- `routes/ui/grid.py:get_grid_runs` — `attach_dag_versions_to_runs` helper +
dict-based `GridRunsResponse.model_validate({...})`.
Tests in `tests/unit/api_fastapi/core_api/routes/ui/test_grid.py`
auto-merged.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.7)
Generated-by: Claude Code (Opus 4.7) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]