You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/08/29 14:37:49 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #33732: Fix MappedTaskGroup tasks not respecting upstream dependency

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


##########
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:
   This logic should be in `_create_task_group` instead. The function is also called in `__call__` and this change is breaking the non-expanding use cases.



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

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