Taragolis commented on code in PR #34016:
URL: https://github.com/apache/airflow/pull/34016#discussion_r1313183190


##########
docs/apache-airflow/core-concepts/xcoms.rst:
##########
@@ -25,9 +25,19 @@ XComs (short for "cross-communications") are a mechanism 
that let :doc:`tasks` t
 
 An XCom is identified by a ``key`` (essentially its name), as well as the 
``task_id`` and ``dag_id`` it came from. They can have any (serializable) 
value, but they are only designed for small amounts of data; do not use them to 
pass around large values, like dataframes.
 
-XComs are explicitly "pushed" and "pulled" to/from their storage using the 
``xcom_push`` and ``xcom_pull`` methods on Task Instances. Many operators will 
auto-push their results into an XCom key called ``return_value`` if the 
``do_xcom_push`` argument is set to ``True`` (as it is by default), and 
``@task`` functions do this as well.
+XComs are explicitly "pushed" and "pulled" to/from their storage using the 
``xcom_push`` and ``xcom_pull`` methods on Task Instances. 
 
-``xcom_pull`` defaults to using this key if no key is passed to it, meaning 
it's possible to write code like this::
+To push a value within a task called **"task-1"** that will be used by another 
task:
+
+    # pushes data in any_serializable_value into xcom with key "identifier as 
string"
+    task_instance.xcom_push(key="identifier as string", 
value=any_serializable_value)

Review Comment:
   ```suggestion
   .. code-block:: python
   
       # pushes data in any_serializable_value into xcom with key "identifier 
as string"
       task_instance.xcom_push(key="identifier as string", 
value=any_serializable_value)
   ```



##########
docs/apache-airflow/core-concepts/xcoms.rst:
##########
@@ -25,9 +25,19 @@ XComs (short for "cross-communications") are a mechanism 
that let :doc:`tasks` t
 
 An XCom is identified by a ``key`` (essentially its name), as well as the 
``task_id`` and ``dag_id`` it came from. They can have any (serializable) 
value, but they are only designed for small amounts of data; do not use them to 
pass around large values, like dataframes.
 
-XComs are explicitly "pushed" and "pulled" to/from their storage using the 
``xcom_push`` and ``xcom_pull`` methods on Task Instances. Many operators will 
auto-push their results into an XCom key called ``return_value`` if the 
``do_xcom_push`` argument is set to ``True`` (as it is by default), and 
``@task`` functions do this as well.
+XComs are explicitly "pushed" and "pulled" to/from their storage using the 
``xcom_push`` and ``xcom_pull`` methods on Task Instances. 
 
-``xcom_pull`` defaults to using this key if no key is passed to it, meaning 
it's possible to write code like this::
+To push a value within a task called **"task-1"** that will be used by another 
task:
+
+    # pushes data in any_serializable_value into xcom with key "identifier as 
string"
+    task_instance.xcom_push(key="identifier as string", 
value=any_serializable_value)

Review Comment:
   Better check this suggestion locally 



##########
docs/apache-airflow/core-concepts/xcoms.rst:
##########
@@ -25,9 +25,19 @@ XComs (short for "cross-communications") are a mechanism 
that let :doc:`tasks` t
 
 An XCom is identified by a ``key`` (essentially its name), as well as the 
``task_id`` and ``dag_id`` it came from. They can have any (serializable) 
value, but they are only designed for small amounts of data; do not use them to 
pass around large values, like dataframes.
 
-XComs are explicitly "pushed" and "pulled" to/from their storage using the 
``xcom_push`` and ``xcom_pull`` methods on Task Instances. Many operators will 
auto-push their results into an XCom key called ``return_value`` if the 
``do_xcom_push`` argument is set to ``True`` (as it is by default), and 
``@task`` functions do this as well.
+XComs are explicitly "pushed" and "pulled" to/from their storage using the 
``xcom_push`` and ``xcom_pull`` methods on Task Instances. 
 
-``xcom_pull`` defaults to using this key if no key is passed to it, meaning 
it's possible to write code like this::
+To push a value within a task called **"task-1"** that will be used by another 
task:
+
+    # pushes data in any_serializable_value into xcom with key "identifier as 
string"
+    task_instance.xcom_push(key="identifier as string", 
value=any_serializable_value)
+
+To pull the value that was pushed in the code above in a different task:
+
+    # pulls the xcom variable with key "identifier as string" that was pushed 
from within task-1
+    task_instance.xcom_pull(key="identifier as string", task_ids="task-1")

Review Comment:
   ```suggestion
   .. code-block:: python
   
       # pulls the xcom variable with key "identifier as string" that was 
pushed from within task-1
       task_instance.xcom_pull(key="identifier as string", task_ids="task-1")
   ```



-- 
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-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to