potiuk commented on code in PR #28001:
URL: https://github.com/apache/airflow/pull/28001#discussion_r1039055381
##########
docs/apache-airflow/concepts/dynamic-task-mapping.rst:
##########
@@ -296,8 +296,93 @@ Similar to ``expand``, you can also map against a XCom
that returns a list of di
task_id="copy_files", source_bucket_name=list_filenames.bucket
).expand_kwargs(copy_kwargs)
-Filtering items from an expanded task
-=====================================
+Mapping over a task group
+=========================
+
+Similar to a TaskFlow task, you can also call either ``expand`` or
``expand_kwargs`` on a ``@task_group``-decorated function to create a mapped
task group:
+
+.. note:: Implementations of individual tasks in this section are omitted for
brevity.
+
+.. code-block:: python
+
+ @task_group
+ def file_transforms(filename):
+ return convert_to_yaml(filename)
+
+
+ file_transforms.expand(filename=["data1.json", "data2.json"])
+
+In the above example, task ``convert_to_yaml`` is expanded into two task
instances at runtime. The first expanded would receive ``"data1.json"`` as
input, and the second ``"data2.json"``.
+
+.. note:: Arguments passed to a mapped task group is a proxy, not real values
+
+ Different from task functions (``@task``), a task group function is
evaluated eagerly, and only once when the DAG is parsed. This means that
parameters passed into the function is only a placeholder, and not a real
value. For example, this will *not* work:
Review Comment:
Agree. The whole documentation update is great. It's hard to explain it
cleared, but maybe siimply state (instead of `eagerly` that it is evaluated
during parsing, in the scheduler and not during exection in worker?
That could help understand what's going on.
--
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]