raphaelauv commented on code in PR #74801:
URL: https://github.com/apache/airflow/pull/74801#discussion_r4323317372


##########
airflow-core/docs/authoring-and-scheduling/dynamic-task-mapping.rst:
##########
@@ -365,6 +365,40 @@ Similar to a TaskFlow task, you can also call either 
``expand`` or ``expand_kwar
 
 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"``.
 
+Mapping over a task group with Object Oriented Programming
+----------------------------------------------------------
+
+To map a group of classic operators, use ``MappedTaskGroup.expand`` (or 
``MappedTaskGroup.expand_kwargs``) as a context manager. Mapped values are 
passed as a dict, and any other keyword arguments are forwarded to 
``TaskGroup``. Inside the group, ``get_mapped_argument`` returns a reference 
that is resolved for each expanded instance when it is passed to a templated 
field:
+
+.. code-block:: python
+
+    import time
+
+    from airflow.providers.standard.operators.bash import BashOperator
+    from airflow.providers.standard.operators.python import PythonOperator
+    from airflow.sdk import MappedTaskGroup

Review Comment:
   the class MappedTaskGroup already exist, that's why I did this poc with it.
   
   Yes `TaskGroup.expand` sounds better. Thanks for the guidance



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