uranusjr commented on a change in pull request #20044:
URL: https://github.com/apache/airflow/pull/20044#discussion_r785629987
##########
File path: tests/operators/test_python.py
##########
@@ -26,6 +26,7 @@
from typing import List
import pytest
+from parameterized import parameterized
Review comment:
Can we use this chance to convert `TestShortCircuitOperator` away from
`unittest.TestCase`? `pytest.mark.parametrize` is better than `parameterized`
in many aspects.
##########
File path: docs/apache-airflow/howto/operator/python.rst
##########
@@ -90,7 +90,57 @@ If additional parameters for package installation are needed
pass them in ``requ
All supported options are listed in the `requirements file format
<https://pip.pypa.io/en/stable/reference/requirements-file-format/#supported-options>`_.
+.. _howto/operator:ShortCircuitOperator:
+
+ShortCircuitOperator
+========================
+
+Use the :class:`~airflow.operators.python.ShortCircuitOperator` to control
whether a pipeline continues
+if a condition is satisfied or a Truthy value is obtained. The evaluation of
this condition and Truthy value
+is done via the output of a ``python_callable``. If the ``python_callable``
returns True or a Truthy value,
Review comment:
Why are *Truthy* and *Falsy* capitalised? The existing code base does
not do this and simply writes them in lower-cased form.
##########
File path: airflow/operators/python.py
##########
@@ -252,13 +268,21 @@ def execute(self, context: Context) -> Any:
self.log.info('Proceeding with downstream tasks...')
return condition
- self.log.info('Skipping downstream tasks...')
-
- downstream_tasks = context["task"].get_flat_relatives(upstream=False)
- self.log.debug("Downstream task_ids %s", downstream_tasks)
+ downstream_tasks = context['task'].get_flat_relatives(upstream=False)
+ self.log.debug("Downstream tasks %s", downstream_tasks)
Review comment:
The previous log (task _ID_) seems more accurate? Doesn’t really matter
though.
--
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]