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
BashOperatorcalledpull_saleswith a bash command ofwget https://salestracking/latestinfo?json. - Set the
pull_salesoperator to run before thecleanuptask. - Configure
consolidateto run next, using the downstream operator. - Set
push_datato 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 ____