Skip to content

Commit 423f79b

Browse files
kaxilCloud Composer Team
authored and
Cloud Composer Team
committed
Add some tasks using BashOperator in TaskGroup example dag (#11072)
Previously all the tasks in airflow/example_dags/example_task_group.py were using DummyOperator which does not go to executor and is marked as success in Scheduler itself so it would be good to have some tasks that aren't dummy operator to properly test TaskGroup functionality GitOrigin-RevId: 45639cd99c2634fde8b53c74eb8bbda1db66005d
1 parent a460a7f commit 423f79b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

airflow/example_dags/example_task_group.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"""Example DAG demonstrating the usage of the TaskGroup."""
2020

2121
from airflow.models.dag import DAG
22+
from airflow.operators.bash import BashOperator
2223
from airflow.operators.dummy_operator import DummyOperator
2324
from airflow.utils.dates import days_ago
2425
from airflow.utils.task_group import TaskGroup
@@ -30,7 +31,7 @@
3031
# [START howto_task_group_section_1]
3132
with TaskGroup("section_1", tooltip="Tasks for section_1") as section_1:
3233
task_1 = DummyOperator(task_id="task_1")
33-
task_2 = DummyOperator(task_id="task_2")
34+
task_2 = BashOperator(task_id="task_2", bash_command='echo 1')
3435
task_3 = DummyOperator(task_id="task_3")
3536

3637
task_1 >> [task_2, task_3]
@@ -42,7 +43,7 @@
4243

4344
# [START howto_task_group_inner_section_2]
4445
with TaskGroup("inner_section_2", tooltip="Tasks for inner_section2") as inner_section_2:
45-
task_2 = DummyOperator(task_id="task_2")
46+
task_2 = BashOperator(task_id="task_2", bash_command='echo 1')
4647
task_3 = DummyOperator(task_id="task_3")
4748
task_4 = DummyOperator(task_id="task_4")
4849

0 commit comments

Comments
 (0)