hkc-8010 opened a new pull request, #69933:
URL: https://github.com/apache/airflow/pull/69933
When a TaskGroup depends on another TaskGroup through a list (`[group_a,
group_b] >> group_c`)
or through a task-level dependency that crosses into another group's entry
task, the grid/graph
view sorts the groups as if there were no dependency at all.
`_project_child_deps` only looks at
a group's own `upstream_task_ids`, which stays empty in both cases:
group-to-group edges only
populate `upstream_group_ids`, and a task-level edge into another group's
entry task never
touches the group object itself.
This also pulls in a group's `upstream_group_ids` and its root tasks'
upstream ids before
projecting sibling dependencies, in both the serialization-layer sort
(`airflow-core`) and the
design-time sort (`task-sdk`) - they share the same algorithm since the
#67288/#67688
performance rewrite.
closes: #65291
related: #67964 and #65639 both attempted this fix earlier but were written
against the
pre-rewrite `topological_sort` implementation (Kahn's-algorithm style),
which no longer exists
after #67288 and #67688 replaced it with the sweep/pass-numbering projection
used today. Both
were closed for inactivity/never reviewed rather than merged.
## Changes
- `airflow-core/src/airflow/serialization/definitions/taskgroup.py`:
`_project_child_deps` also
considers group-to-group edges (`upstream_group_ids`) and cross-group
task-level edges (root
tasks' `upstream_task_ids`)
- `task-sdk/src/airflow/sdk/definitions/taskgroup.py`: same fix, mirrored
design-time sort
- Tests for both new scenarios, plus two existing tests whose hardcoded
expected orderings were
corrected (they were encoding the old, buggy order)
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (Claude Code)
Generated-by: Claude Code following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment:
`{pr_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
You can add this file in a follow-up commit after the PR is created so you
know the PR number.
--
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]