Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Apache Airflow in Python

Cursus bekijken

Oefeninstructies

  • Define a BashOperator called pull_sales with a bash command of wget https://salestracking/latestinfo?json.
  • Set the pull_sales operator to run before the cleanup task.
  • Configure consolidate to run next, using the downstream operator.
  • Set push_data to run last using either bitshift operator.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 ____
Code bewerken en uitvoeren