Define order of Tasks
Now that you've learned about the bitshift syntax, it's time to define the task ordering. You have three currently defined tasks, cleanup, consolidate, and push_data.
The dag and task decorators from airflow.sdk are already imported.
This exercise is part of the course
Introduction to Apache Airflow in Python
Exercise instructions
- Configure the
cleanuptask to run first before theconsolidatetask, using the bitshift syntax. - Configure
consolidateto run next and thepush_datatask to run last.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
@dag(
dag_id="analytics_dag",
start_date=datetime(2026, 3, 1),
)
def analytics_dag():
# Run cleanup before consolidate
cleanup() ____ consolidate()
# Run consolidate before push_data
____
analytics_dag()