Skip to content

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

Closed

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

Activity

  1. added
    kind:bug
    needs-triage
    on Apr 15, 2026
  2. added
    area:UI
    on Apr 15, 2026
  3. prasadf18 commented on Apr 15, 2026

    @prasadf18

    can anyone assign this to me. thanks

  4. fufuShih commented on Apr 15, 2026

    @fufuShih

    c >> a and iterating b >> a record dependency metadata differently, so airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py can produce a different ordering when building the Grid structure.

  5. bbovenzi commented on Apr 21, 2026

    @bbovenzi
    Contributor

    Looked into this. This is a dag serialization issue. Not UI. I just opened a draft PR.

  6. added and removed
    area:UI
    needs-triage
    on Apr 21, 2026
  7. added 2 commits that reference this issue on Jul 28, 2026
    db20066
    d7aa929
  8. added a commit that references this issue on Jul 28, 2026
    ff75d24
  9. added a commit that references this issue on Aug 5, 2026
    7844ccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corekind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions