Branching
This lesson explains how DAGs can incorporate branching logic within their workflows.
We'll cover the following
As we write more complex workflows, a need arises to create branches within our workflows. Depending on the evaluation of some user-specified conditions, the workflow may execute a different set of tasks. Airflow provides operators to enable branching in workflows.
Branching
Consider the simple workflow below. We have task1
execute first, followed by task2
, and, after that, the workflow branches and either executes task3
or task4
. We can use the BranchPythonOperator
to implement our desired workflow. Here is an illustration depicting the workflow:
Get hands-on with 1400+ tech skills courses.