hsnprsd commented on a change in pull request #12376:
URL: https://github.com/apache/airflow/pull/12376#discussion_r523927879
##########
File path: airflow/example_dags/example_xcom.py
##########
@@ -43,24 +44,14 @@ def push_by_returning(**kwargs):
return value_2
-def puller(**kwargs):
+def puller(pulled_value_1, pulled_value_2, **kwargs):
"""Pull all previously pushed XComs and check if the pushed values match
the pulled values."""
- ti = kwargs['ti']
- # get value_1
- pulled_value_1 = ti.xcom_pull(key=None, task_ids='push')
+ # check pulled value 1
if pulled_value_1 != value_1:
raise ValueError(f'The two values differ {pulled_value_1} and
{value_1}')
- # get value_2
- pulled_value_2 = ti.xcom_pull(task_ids='push_by_returning')
- if pulled_value_2 != value_2:
- raise ValueError(f'The two values differ {pulled_value_2} and
{value_2}')
-
- # get both value_1 and value_2
- pulled_value_1, pulled_value_2 = ti.xcom_pull(key=None, task_ids=['push',
'push_by_returning'])
- if pulled_value_1 != value_1:
- raise ValueError(f'The two values differ {pulled_value_1} and
{value_1}')
Review comment:
I do agree. Will fix it.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]