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/12/08 15:14:41 UTC

[GitHub] [airflow] eladkal commented on a change in pull request #20071: ShortCircuitOperator pushs XCom

eladkal commented on a change in pull request #20071:
URL: https://github.com/apache/airflow/pull/20071#discussion_r764958126



##########
File path: tests/operators/test_python.py
##########
@@ -703,6 +703,25 @@ def test_clear_skipped_downstream_task(self):
             else:
                 raise ValueError(f'Invalid task id {ti.task_id} found!')
 
+    def test_xcom_push(self):
+        dag = DAG(
+            'shortcircuit_operator_test_xcom_push',
+            default_args={'owner': 'airflow', 'start_date': DEFAULT_DATE},
+            schedule_interval=INTERVAL,
+        )
+        short_op = ShortCircuitOperator(task_id='make_choice', dag=dag, python_callable=lambda: 'signature')

Review comment:
       I think this is not doing what you expect.
   In `ShortCircuitOperator` the python_callable returns only True/False values.
   If the value is False then the operator is looking for the downstream tasks and change their status to Skip.
   It's not the same as `BranchPythonOperator` where the python callable is expected to return `task_ids`.

##########
File path: airflow/operators/python.py
##########
@@ -248,7 +248,7 @@ def execute(self, context: Dict):
 
         if condition:
             self.log.info('Proceeding with downstream tasks...')
-            return
+            return condition

Review comment:
       The value of condition is always True in this case.




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