houqp commented on a change in pull request #10153:
URL: https://github.com/apache/airflow/pull/10153#discussion_r477713551



##########
File path: airflow/models/baseoperator.py
##########
@@ -382,7 +389,16 @@ def __init__(
                 stacklevel=3
             )
         validate_key(task_id)
-        self.task_id = task_id
+        self.label = task_id
+
+        # Prefix task_id with group_id
+        task_group = task_group or TaskGroupContext.get_current_task_group(dag)
+        if task_group:
+            self.task_id = f"{task_group.group_id}.{self.label}" if 
task_group.group_id else self.label

Review comment:
       I see where you are coming from now. I get that the semantic of task_id 
will remain the same if task group is not being used. I am trying to see if we 
can maintain that for task grouped tasks as well so it will be less surprise 
for people when they adopt it.
   
   I agree with you that asking users to manually label tasks is not a good 
experience and we should not go that route.
   
   It looks like the core of the problem is task names could conflict between 
groups. Is that an option to simply not allow users define tasks with 
conflicting names across groups? Or do we have to support task_id namespacing 
by group due to how it's being handled in subdag operator? I feel like this 
will simplify the design a lot and make it truly a UI-only feature.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to