Repository navigation
Description
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.
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.
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.
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.
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.
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.
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 #56963.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
prasadf18 commentedon Apr 15, 2026
can anyone assign this to me. thanks
fufuShih commentedon Apr 15, 2026
c >> aand iteratingb >> arecord dependency metadata differently, soairflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.pycan produce a different ordering when building the Grid structure.bbovenzi commentedon Apr 21, 2026
Looked into this. This is a dag serialization issue. Not UI. I just opened a draft PR.
Fix grid/graph view topological sort for group-level and cross-group …
Fix grid/graph view topological sort for group-level and cross-group …
Fix grid/graph view topological sort for group-level and cross-group …
Fix grid/graph view topological sort for group-level and cross-group …