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



##########
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:
       Actually I think you have a really good point. In fact, after trying 
this out over some real existing DAGs, I realized leaving `task_id` fully to 
the user is better. For existing DAGs, when people want to convert to use 
TaskGroups, they don't want to modify the `task_id` (because doing so causes 
the tasks to appear as new tasks in the DAG).
   
   So I took your suggestion:
   - Removed `label`
   - Do not prefix `task_id` with group_id
   - Require `group_id` and `task_id` to be unique throughout the whole DAG




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