- airflow.models.skipmixin.XCOM_SKIPMIXIN_KEY = skipmixin_key¶
- airflow.models.skipmixin.XCOM_SKIPMIXIN_SKIPPED = skipped¶
- airflow.models.skipmixin.XCOM_SKIPMIXIN_FOLLOWED = followed¶
- class airflow.models.skipmixin.SkipMixin(context=None)¶
A Mixin to skip Tasks Instances
- skip(self, dag_run: airflow.models.dagrun.DagRun, execution_date: pendulum.DateTime, tasks: Sequence[airflow.models.baseoperator.BaseOperator], session: sqlalchemy.Session)¶
Sets tasks instances to skipped from the same dag run.
If this instance has a task_id attribute, store the list of skipped task IDs to XCom so that NotPreviouslySkippedDep knows these tasks should be skipped when they are cleared.
dag_run – the DagRun for which to set the tasks to skipped
execution_date – execution_date
tasks – tasks to skip (not task_ids)
session – db session to use
- skip_all_except(self, ti: airflow.models.taskinstance.TaskInstance, branch_task_ids: Union[str, Iterable[str]])¶
This method implements the logic for a branching operator; given a single task ID or list of task IDs to follow, this skips all other tasks immediately downstream of this operator.
branch_task_ids is stored to XCom so that NotPreviouslySkippedDep knows skipped tasks or newly added tasks should be skipped when they are cleared.