josh-fell commented on a change in pull request #17421:
URL: https://github.com/apache/airflow/pull/17421#discussion_r758728732



##########
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.
+
+In the example below, notice that the ShortCircuitOperator task is configured 
to respect downstream trigger
+rules. This means while the tasks that follow the "short_circuit" 
ShortCircuitOperator task will be skipped
+since the ``python_callable`` returns False, "task_7" will still execute as 
its set to execute when upstream
+tasks have completed running regardless of status.
+
+.. exampleinclude:: 
/../../airflow/example_dags/example_short_circuit_operator.py
+    :language: python
+    :dedent: 4
+    :start-after: [START howto_operator_short_circuit_trigger_rules]
+    :end-before: [END howto_operator_short_circuit_trigger_rules]
+
+
+
+Passing in arguments
+^^^^^^^^^^^^^^^^^^^^
+
+Both the ``op_args`` and ``op_kwargs`` arguments can be used in same way as 
described for the PythonOperator.
+

Review comment:
       Hmm. It might be useful to keep this context so new users know that they 
can pass args to the `python_callable` to influence the True/False return value.
   
   The same note is in the `PythonVirtualEnvOperator` too.




-- 
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]


Reply via email to