uranusjr commented on code in PR #33732:
URL: https://github.com/apache/airflow/pull/33732#discussion_r1308941671


##########
airflow/decorators/task_group.py:
##########
@@ -132,11 +132,14 @@ def expand(self, **kwargs: OperatorExpandArgument) -> 
DAGNode:
         self._validate_arg_names("expand", kwargs)
         prevent_duplicates(self.partial_kwargs, kwargs, fail_reason="mapping 
already partial")
         expand_input = DictOfListsExpandInput(kwargs)
-        return self._create_task_group(
+        new_task_group = self._create_task_group(
             functools.partial(MappedTaskGroup, expand_input=expand_input),
             **self.partial_kwargs,
             **{k: MappedArgument(input=expand_input, key=k) for k in kwargs},
         )
+        for op, _ in expand_input.iter_references():
+            new_task_group.set_upstream(op)

Review Comment:
   Would it work if we put this in MappedTaskGroup’s `__exit__` instead? I 
think that’s where all the dependencies are ready?



##########
airflow/decorators/task_group.py:
##########
@@ -132,11 +132,14 @@ def expand(self, **kwargs: OperatorExpandArgument) -> 
DAGNode:
         self._validate_arg_names("expand", kwargs)
         prevent_duplicates(self.partial_kwargs, kwargs, fail_reason="mapping 
already partial")
         expand_input = DictOfListsExpandInput(kwargs)
-        return self._create_task_group(
+        new_task_group = self._create_task_group(
             functools.partial(MappedTaskGroup, expand_input=expand_input),
             **self.partial_kwargs,
             **{k: MappedArgument(input=expand_input, key=k) for k in kwargs},
         )
+        for op, _ in expand_input.iter_references():
+            new_task_group.set_upstream(op)

Review Comment:
   Would it work if we put this in MappedTaskGroup’s `__exit__` instead? I 
think that’s where all the dependencies are ready?



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