wolfier opened a new issue, #65291:
URL: https://github.com/apache/airflow/issues/65291
### Under which category would you file this issue?
Airflow Core
### Apache Airflow version
3.2.0+astro.1
### What happened and how to reproduce it?
When setting dependencies between a list of task groups and another task
group, the grid does **NOT** render the task groups in topological order.
This is the Dag where the list of task groups is `c` and the singular task
group is `a`.
```python
import pendulum
from airflow.sdk import dag, task, TaskGroup
from airflow.providers.standard.operators.python import PythonOperator
@dag(
schedule=None,
start_date=pendulum.datetime(2026, 1, 1, tz="UTC"),
dag_id="grid",
)
def grid():
with TaskGroup(group_id="a") as a:
even = PythonOperator(task_id="get_even", python_callable=lambda:
None)
odd = PythonOperator(task_id="get_odd", python_callable=lambda: None)
even >> odd
c = []
for x in range(3):
with TaskGroup(group_id=f"b_{x}") as b:
even = PythonOperator(task_id="get_even",
python_callable=lambda: None)
odd = PythonOperator(task_id="get_odd", python_callable=lambda:
None)
even >> odd
c.append(b)
c >> a
grid()
```
This is the graph render of the Dag.
<img width="693" height="517" alt="Image"
src="https://github.com/user-attachments/assets/17deb388-f8e9-4068-a36c-aac32f17f9a6"
/>
This is the grid render of the Dag. Notice the task groups (`b_0`, `b_1`,
and `b_2`) is **BELOW** the task group `a`.
<img width="321" height="278" alt="Image"
src="https://github.com/user-attachments/assets/85bfdee9-e7ce-4bf9-9f12-f09f2ffc141b"
/>
### What you think should happen instead?
When the dependencies are set between individual task groups, the grid view
does render the task groups topologically. I expect this Dag to render the task
groups in the same order as below.
```python
import pendulum
from airflow.sdk import dag, task, TaskGroup
from airflow.providers.standard.operators.python import PythonOperator
@dag(
schedule=None,
start_date=pendulum.datetime(2026, 1, 1, tz="UTC"),
dag_id="grid",
)
def grid():
with TaskGroup(group_id="a") as a:
even = PythonOperator(task_id="get_even", python_callable=lambda:
None)
odd = PythonOperator(task_id="get_odd", python_callable=lambda: None)
even >> odd
for x in range(3):
with TaskGroup(group_id=f"b_{x}") as b:
even = PythonOperator(task_id="get_even",
python_callable=lambda: None)
odd = PythonOperator(task_id="get_odd", python_callable=lambda:
None)
even >> odd
b >> a
grid()
```
This is the graph render of the Dag.
<img width="680" height="519" alt="Image"
src="https://github.com/user-attachments/assets/eb16c205-15e9-4c20-ab00-45a1c0a59d30"
/>
This is the grid render of the Dag. Notice the task groups (`b_0`, `b_1`,
and `b_2`) is **ABOVE** the task group `a`.
<img width="323" height="277" alt="Image"
src="https://github.com/user-attachments/assets/45039e8f-9e8d-4eee-97c7-0f3ed2c69c48"
/>
### Operating System
Debian GNU/Linux 13 (trixie)
### Deployment
Astronomer
### Apache Airflow Provider(s)
_No response_
### Versions of Apache Airflow Providers
_No response_
### Official Helm Chart version
Not Applicable
### Kubernetes Version
_No response_
### Helm Chart configuration
_No response_
### Docker Image customizations
_No response_
### Anything else?
I suspect this is related to https://github.com/apache/airflow/pull/56963.
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]