turbaszek commented on a change in pull request #12312:
URL: https://github.com/apache/airflow/pull/12312#discussion_r522870268



##########
File path: airflow/operators/python.py
##########
@@ -190,7 +193,15 @@ def _get_unique_task_id(task_id: str, dag: Optional[DAG] = 
None) -> str:
           task_id__20
         """
         dag = dag or DagContext.get_current_dag()
-        if not dag or task_id not in dag.task_ids:
+        if not dag:
+            return task_id
+
+        # We need check if we are in context of TaskGroup as the task_id may
+        # already be altered
+        task_group = task_group or TaskGroupContext.get_current_task_group(dag)
+        tg_task_id = task_group.child_id(task_id) if task_group else None
+
+        if (task_id not in dag.task_ids) and (tg_task_id not in dag.task_ids):

Review comment:
       Yup, that make sense!




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