kazanzhy commented on a change in pull request #20044:
URL: https://github.com/apache/airflow/pull/20044#discussion_r765068975
##########
File path: docs/apache-airflow/howto/operator/python.rst
##########
@@ -80,7 +80,54 @@ Otherwise you won't have access to the most context
variables of Airflow in ``op
If you want the context related to datetime objects like
``data_interval_start`` you can add ``pendulum`` and
``lazy_object_proxy``.
+
+
+.. _howto/operator:ShortCircuitOperator:
+
+ShortCircuitOperator
+========================
+
+Use the :class:`~airflow.operators.python.ShortCircuitOperator` to control
whether a pipeline continues only
+if a condition is satisfied. The evaluation of this condition is done via the
output of a ``python_callable``.
+If the ``python_callable`` returns True, the condition is considered satisfied
and the pipeline is allowed to
+continue. In the example below, the tasks that follow the "condition_is_True"
ShortCircuitOperator will
+execute while the tasks downstream of the "condition_is_False"
ShortCircuitOperator will be skipped.
+
+
+.. exampleinclude::
/../../airflow/example_dags/example_short_circuit_operator.py
+ :language: python
+ :dedent: 4
+ :start-after: [START howto_operator_short_circuit]
+ :end-before: [END howto_operator_short_circuit]
+
+
+The "short-circuiting" can be configured to either respect or ignore the
``trigger_rule`` defined
+for downstream tasks. If ``ignore_downstream_trigger_rules`` is set to True,
the default configuration, all
+downstream tasks are skipped without considering the ``trigger_rule`` defined
for tasks. 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 task(s) were
+purposely meant to be skipped but perhaps not other subsequent tasks.
+
Review comment:
I think that will be very useful for users to add the following
explanation. Because I still can't get some nuances.
```suggestion
Let's assume that ``python_callable`` returns ``False``. If
``ignore_downstream_trigger_rules=True`` then all downstream tasks will be
skipped. But if ``ignore_downstream_trigger_rules=False``then downstream tasks
with trigger rules ``['all_done', 'dummy', 'none_failed']`` will be run anyway,
tasks with trigger rules ``['all_success', 'all_failed', 'none_skipped']`` will
be skipped anyway and tasks with ``['one_failed', 'one_success']`` will be run
if they have other coincident tasks
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]