ashb commented on a change in pull request #19914:
URL: https://github.com/apache/airflow/pull/19914#discussion_r768146304



##########
File path: airflow/utils/task_group.py
##########
@@ -115,10 +115,10 @@ def __init__(
                 raise AirflowException("TaskGroup must have a parent_group 
except for the root TaskGroup")
             self.used_group_ids = self._parent_group.used_group_ids
 
-        self._group_id = group_id

Review comment:
       The rest of the change here looks a bit odd (setting _group_id twice 
etc).
   
   ```diff
   diff --git a/airflow/utils/task_group.py b/airflow/utils/task_group.py
   index e2e85a76c..e6a235b15 100644
   --- a/airflow/utils/task_group.py
   +++ b/airflow/utils/task_group.py
   @@ -118,10 +118,10 @@ class TaskGroup(TaskMixin):
            self._group_id = group_id
            # if given group_id already used assign suffix by incrementing 
largest used suffix integer
            # Example : task_group ==> task_group__1 -> task_group__2 -> 
task_group__3
   -        if group_id in self.used_group_ids:
   +        if self._group_id and self._group_id in self.used_group_ids:
                if not add_suffix_on_collision:
                    raise DuplicateTaskIdFound(f"group_id '{self.group_id}' has 
already been added to the DAG")
   -            base = re.split(r'__\d+$', group_id)[0]
   +            base = re.split(r'__\d+$', self._group_id)[0]
                suffixes = sorted(
                    int(re.split(r'^.+__', used_group_id)[1])
                    for used_group_id in self.used_group_ids
   
   ```




-- 
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: [email protected]

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


Reply via email to