airflow.providers.standard.operators.branch¶
Branching operators.
Classes¶
Utility helper which handles the branching as one-liner. |
|
A base class for creating operators with branching functionality, like to BranchPythonOperator. |
Module Contents¶
- class airflow.providers.standard.operators.branch.BranchMixIn(context=None)[source]¶
Bases:
airflow.providers.standard.utils.skipmixin.SkipMixin
Utility helper which handles the branching as one-liner.
- class airflow.providers.standard.operators.branch.BaseBranchOperator(**kwargs)[source]¶
Bases:
airflow.models.baseoperator.BaseOperator
,BranchMixIn
A base class for creating operators with branching functionality, like to BranchPythonOperator.
Users should create a subclass from this operator and implement the function choose_branch(self, context). This should run whatever business logic is needed to determine the branch, and return one of the following: - A single task_id (as a str) - A single task_group_id (as a str) - A list containing a combination of task_ids and task_group_ids
The operator will continue with the returned task_id(s) and/or task_group_id(s), and all other tasks directly downstream of this operator will be skipped.
- inherits_from_skipmixin = True[source]¶
Used to determine if an Operator is inherited from SkipMixin or its subclasses (e.g., BranchMixin).
- abstract choose_branch(context)[source]¶
Abstract method to choose which branch to run.
Subclasses should implement this, running whatever logic is necessary to choose a branch and returning a task_id or list of task_ids.
- Parameters:
context (airflow.sdk.definitions.context.Context) – Context dictionary as passed to execute()