Skip to content

Mapped, classic operator tasks within TaskGroups prepend group_id in Graph View #25523

@josh-fell

Description

@josh-fell

Apache Airflow version

main (development)

What happened

When mapped, classic operator tasks exist within TaskGroups, the group_id of the TaskGroup is prepended to the displayed task_id in the Graph View.

In the below screenshot, all displayed task IDs only contain the direct task_id except for the "mapped_classic_task". This particular task is a mapped BashOperator task. The prepended group_id does not appear for unmapped, classic operator tasks, nor mapped and unmapped TaskFlow tasks.

image

What you think should happen instead

The pattern of the displayed task names should be consistent for all task types (mapped/unmapped, classic operators/TaskFlow functions). Additionally, having the group_id prepended to the mapped, classic operator tasks is a little redundant and less readable.

How to reproduce

  1. Use an example DAG of the following:
from pendulum import datetime

from airflow.decorators import dag, task, task_group
from airflow.operators.bash import BashOperator


@dag(start_date=datetime(2022, 1, 1), schedule_interval=None)
def task_group_task_graph():
    @task_group
    def my_task_group():
        BashOperator(task_id="not_mapped_classic_task", bash_command="echo")
        BashOperator.partial(task_id="mapped_classic_task").expand(
            bash_command=["echo", "echo hello", "echo world"]
        )

        @task
        def another_task(input=None):
            ...

        another_task.override(task_id="not_mapped_taskflow_task")()
        another_task.override(task_id="mapped_taskflow_task").expand(input=[1, 2, 3])

    my_task_group()


_ = task_group_task_graph()
  1. Navigate to the Graph view
  2. Notice that the task_id for the "mapped_classic_task" prepends the TaskGroup group_id of "my_task_group" while the other tasks in the TaskGroup do not.

Operating System

Debian GNU/Linux

Versions of Apache Airflow Providers

N/A

Deployment

Other

Deployment details

Breeze

Anything else

Setting prefix_group_id=False for the TaskGroup does remove the prepended group_id from the tasks display name.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected_version:main_branchIssues Reported for main brancharea:UIRelated to UI/UX. For Frontend Developers.kind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions