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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]