BranchPythonOperator
Apache AirflowAllows a workflow to “branch” or follow a path following the execution of this task.
Access Instructions
Install the Apache Airflow provider package into your Airflow environment.
Import the module into your DAG file and instantiate it with your desired params.
Parameters
Documentation
Allows a workflow to “branch” or follow a path following the execution of this task.
It derives the PythonOperator and expects a Python function that returns a single task_id or list of task_ids to follow. The task_id(s) returned should point to a task directly downstream from {self}. All other “branches” or directly downstream tasks are marked with a state of skipped
so that these paths can’t move forward. The skipped
states are propagated downstream to allow for the DAG state to fill up and the DAG run’s state to be inferred.
Example DAGs
Example DAG demonstrating the usage of the BranchPythonOperator.
Example DAG demonstrating the usage of BranchPythonOperator with depends_on_past=True, where tasks may be run or skipped on alternating runs.
Example DAG demonstrating a workflow with nested branching. The join tasks are created with none_failed_or_skipped trigger rule such that they are skipped whenever their corresponding BranchPythonOper…