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



##########
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:
       > So if we simply remove the notion of label in this PR, we can achieve 
that. That means the label in Graph View will be the same as task_id. And users 
have to do their own work to maintain unique task_id across the entire DAG, and 
across TaskGroups.
   
   This is what I have in mind as well since we already require users to make 
sure task_ids are unique today. I previous comment as asking whether there is 
some sort of special requirement in subdag support that requires us to support 
task namespacing within the group. Based on your answer, it looks like there 
isn't.
   
   I would prefer we go with the simpler route, i.e. dropping label, if it 
meets all our existing requirements. So far, it maintains task_id semantics and 
comes with lower code complexity, so it's a win win to me :)




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