8. Two Regions, One Publish
Difficulty: Medium · Topic: Task groups
The DAG regional_sales runs @daily from 2026-01-01 (no catchup). Two regions run the same two steps, side by side:
- Use a
TaskGroupfor each region, with the group idseuandus. - Each group has
extract(extract --region eu --date {{ ds }}, with its own region) followed byload(load --region eu --date {{ ds }}). publish(publish --date {{ ds }}) runs after both groups have finished successfully.
The regions run at the same time and do not depend on each other: a failure in one must not stop the other. All tasks are BashOperators, so the ids are eu.extract, eu.load, us.extract, us.load and publish.
Your DAG file is run in a simulation of the Airflow 3 scheduler against 4 scenarios, including hidden ones.
Sample scenario: Both regions finish
Deployed 2026-01-07 00:30 UTC, read at 2026-01-07 02:00 UTC.
Expected runs
- Run at 2026-01-07 00:00 UTC: success. eu.extract success, us.extract success, eu.load success, us.load success, publish success
Hints
Hint 1
Tasks made insidewith TaskGroup(group_id="eu") as eu: get the id eu.extract, so the same task_id can be used in both groups.Hint 2
A group can be used in a dependency:[eu, us] >> publish connects the last tasks of each group to publish.Hint 3
Afor loop over the regions saves writing each group by hand.Learn the concepts
- Task groups, setup and teardown · 5 min read. Organise a large DAG into groups, and pair resources with their clean-up.