airflow.providers.standard.operators.latest_only

Contains an operator to run downstream tasks only for the latest scheduled DagRun.

Classes

LatestOnlyOperator

Skip tasks that are not running during the most recent schedule interval.

Module Contents

class airflow.providers.standard.operators.latest_only.LatestOnlyOperator(**kwargs)[source]

Bases: airflow.providers.standard.operators.branch.BaseBranchOperator

Skip tasks that are not running during the most recent schedule interval.

If the task is run outside the latest schedule interval (i.e. run_type == DagRunType.MANUAL), all directly downstream tasks will be skipped.

Note that downstream tasks are never skipped if the given DAG_Run is marked as externally triggered.

Note that when used with timetables that produce zero-length or point-in-time data intervals (e.g., DeltaTriggerTimetable), this operator assumes each run is the latest and does not skip downstream tasks.

ui_color = '#e9ffdb'[source]
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()

Was this entry helpful?