You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/10 01:22:50 UTC

[GitHub] [airflow] josh-fell commented on a change in pull request #17421: Add ShortCircuitOperator configurability for respecting downstream trigger rules

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



##########
File path: airflow/operators/python.py
##########
@@ -219,17 +219,31 @@ def execute(self, context: Dict):
 
 class ShortCircuitOperator(PythonOperator, SkipMixin):
     """
-    Allows a workflow to continue only if a condition is met. Otherwise, the
-    workflow "short-circuits" and downstream tasks are skipped.
-
-    The ShortCircuitOperator is derived from the PythonOperator. It evaluates a
-    condition and short-circuits the workflow if the condition is False. Any
-    downstream tasks are marked with a state of "skipped". If the condition is
-    True, downstream tasks proceed as normal.
-
-    The condition is determined by the result of `python_callable`.
+    Allows a workflow to continue only if a condition is met. Otherwise, the workflow "short-circuits" and
+    downstream tasks are skipped. 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.
+
+    The ShortCircuitOperator is derived from the PythonOperator. It evaluates a condition and short-circuits
+    the workflow if the condition is False. Any downstream tasks are marked with a state of "skipped" based
+    on the short-circuiting mode configured. If the condition is True, downstream tasks proceed as normal.
+
+    The condition is determined by the result of ``python_callable``.
+
+    :param ignore_downstream_trigger_rules: If 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.
+    :type ignore_downstream_trigger_rules: bool

Review comment:
       Oh yes, 100%. I'll add the necessary context to the docs.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org