This is an automated email from the ASF dual-hosted git repository.
uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new eb47c42d6b Add note about pushing the lazy XCom proxy to XCom (#27250)
eb47c42d6b is described below
commit eb47c42d6ba3ca33cf4223ac6c2a4904cf1f388e
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Thu Nov 3 16:15:20 2022 +0800
Add note about pushing the lazy XCom proxy to XCom (#27250)
---
docs/apache-airflow/concepts/dynamic-task-mapping.rst | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/docs/apache-airflow/concepts/dynamic-task-mapping.rst
b/docs/apache-airflow/concepts/dynamic-task-mapping.rst
index 9f02b92215..10ff5fff01 100644
--- a/docs/apache-airflow/concepts/dynamic-task-mapping.rst
+++ b/docs/apache-airflow/concepts/dynamic-task-mapping.rst
@@ -72,6 +72,17 @@ The grid view also provides visibility into your mapped
tasks in the details pan
You can use normal sequence syntax on this object (e.g. ``values[0]``), or
iterate through it normally with a ``for`` loop. ``list(values)`` will give you
a "real" ``list``, but please be aware of the potential performance
implications if the list is large.
+ Note that the same also applies to when you push this proxy object into
XCom. This, for example, would not
+ work with the default XCom backend:
+
+ .. code-block:: python
+
+ @task
+ def forward_values(values):
+ return values # This is a lazy proxy and can't be pushed!
+
+ You need to explicitly call ``list(values)`` instead, and accept the
performance implications.
+
.. note:: A reduce task is not required.
Although we show a "reduce" task here (``sum_it``) you don't have to have
one, the mapped tasks will still be executed even if they have no downstream
tasks.