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


##########
airflow/utils/task_group.py:
##########
@@ -645,6 +659,20 @@ def get_current_task_group(cls, dag: DAG | None) -> 
TaskGroup | None:
 
         return cls._context_managed_task_group
 
+    @classmethod
+    def add_task(cls, task: DependencyMixin) -> None:
+        """Add the task to the current TaskGroup if not already there."""
+        from airflow.utils.edgemodifier import EdgeModifier
+
+        if isinstance(task, TaskGroup) or isinstance(task, EdgeModifier):
+            return
+        task_ = cast(DAGNode, task)

Review Comment:
   I don’t think these `isinstance` checks (here and in the outer 
`set_taskgroup_ctx_dependencies`) is exhausive enough. Instead of trying to do 
all the checks, it may be better to rethink how this operation would make sense 
to all `DependencyMixin` decendants and use polymorphism to handle this instead.



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

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

Reply via email to