Skip to content

Tasks in the Grid view are not in topological order #65291

@wolfier

Description

@wolfier

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.

Image

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.

Image

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.

Image

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.

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:UIRelated to UI/UX. For Frontend Developers.kind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions