ShortCircuitOperator

Apache Airflow Certified

Allows a pipeline to continue based on the result of a python_callable.

View on GitHub

Last Updated: Apr. 8, 2023

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

ignore_downstream_trigger_rulesIf set to True, all downstream tasks from this operator task will be skipped. This is the default behavior. If set to False, the direct, downstream task(s) will be skipped but the trigger_rule defined for a other downstream tasks will be respected.

Documentation

Allows a pipeline to continue based on the result of a python_callable.

The ShortCircuitOperator is derived from the PythonOperator and evaluates the result of a python_callable. If the returned result is False or a falsy value, the pipeline will be short-circuited. Downstream tasks will be marked with a state of “skipped” based on the short-circuiting mode configured. If the returned result is True or a truthy value, downstream tasks proceed as normal and an XCom of the returned result is pushed.

The short-circuiting can be configured to either respect or ignore the trigger_rule set for downstream tasks. If ignore_downstream_trigger_rules is set to True, the default setting, all downstream tasks are skipped without considering the trigger_rule defined for tasks. However, if this parameter is set to False, the direct downstream tasks are skipped but the specified trigger_rule for other subsequent downstream tasks are respected. In this mode, the operator assumes the direct downstream tasks were purposely meant to be skipped but perhaps not other subsequent tasks.

See also

For more information on how to use this operator, take a look at the guide: ShortCircuitOperator

Was this page helpful?