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



##########
File path: airflow/example_dags/example_xcom.py
##########
@@ -57,6 +58,14 @@ def puller(**kwargs):
         raise ValueError(f'The two values differ {pulled_value_2} and 
{value_2}')
 
 
+def pull_value_from_bash_push(**kwargs):
+    ti = kwargs['ti']
+    bash_pushed_via_return_value = ti.xcom_pull(key="xcom_pushed_value", 
task_ids=['bash_push'])
+    bash_manually_pushed_value = ti.xcom_pull(key="xcom_pushed_value", 
task_ids=['bash_push'])

Review comment:
       I believe the `key` values here should be "return_value" and 
"manually_pushed_value", respectively.  There is no XCom key of 
"xcom_pushed_value" pushed in this DAG.
   
   Also, the `task_ids` type can be a string rather a list if only one 
`task_id` is referenced.  This will return the XCom value in a list rather than 
a single string value.  The XCom value return type is inferred by the type of 
the `task_ids` value in `xcom_pull()` (i.e. if the `task_ids` value is a list, 
the returned XCom value will be a list; if `task_ids` is a string, the returned 
value will be a string).
   
   For example:
   ```python
   bash_pushed_via_return_value = ti.xcom_pull(key="return_value", 
task_ids='bash_push')
   bash_manually_pushed_value = ti.xcom_pull(key="manually_pushed_value", 
task_ids='bash_push')
   ```




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


Reply via email to