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(pre_execute=None, post_execute=None, on_execute_callback=None, on_failure_callback=None, on_success_callback=None, on_retry_callback=None, on_skipped_callback=None, **kwargs)[source]

Bases: airflow.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. external_trigger), all directly downstream tasks will be skipped.

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

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?