Define order of BashOperators
Now that you've learned about the bitshift operators, it's time to modify your workflow to include a pull step and to include the task ordering. You have three currently defined components, cleanup
, consolidate
, and push_data
.
The DAG analytics_dag
is available as before and the BashOperator
is already imported.
This exercise is part of the course
Introduction to Apache Airflow in Python
Exercise instructions
- Define a
BashOperator
calledpull_sales
with a bash command ofwget https://salestracking/latestinfo?json
. - Set the
pull_sales
operator to run before thecleanup
task. - Configure
consolidate
to run next, using the downstream operator. - Set
push_data
to run last using either bitshift operator.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define a new pull_sales task
pull_sales = ____(
task_id='pullsales_task',
____
)
# Set pull_sales to run prior to cleanup
pull_sales ____ cleanup
# Configure consolidate to run after cleanup
____
# Set push_data to run last
consolidate ____