Skip to content
BENIBIX Learn

Airflow Task Group

Data🗓️ OrchestrationApache Airflow

Also known as TaskGroup, Task Group, @task_group

A box that holds related Airflow tasks. Big DAGs get easier to read.

Think of it like

It is like a folder on a desk. Ten loose sheets become one neat folder you can open.

Example

A DAG loads twelve regions. Jack puts the twelve load tasks in a group called load_regions. The graph now shows one box he can open.

Why it matters

Big DAGs turn into a wall of boxes. Groups bring back the shape a person can follow.

Definition

A task group puts related Airflow tasks in one box in the graph view. The box can be closed, so a big DAG is easier to read. The tasks still belong to the same DAG and follow its settings. A group can also set its own defaults, such as the number of retries. Each task's name starts with the group's name, so names stay clear.

Example code

python
from airflow.sdk import task_group

@task_group
def load_regions():
    load_europe()
    load_asia()
Two load tasks inside one group. In the graph they show as one box.
The dashed box is a task group. It holds the three load tasks, and it can close to one box.

Common mistake

Thinking a group is a separate DAG. Its tasks still run inside the same DAG, with the same settings.

Key takeaways

  1. 1
    Tidy view. Many tasks show as one box.
  2. 2
    Same DAG. Not a separate pipeline.
  3. 3
    Shared defaults. A group can set its own.