kacpermuda commented on code in PR #70772:
URL: https://github.com/apache/airflow/pull/70772#discussion_r3683510714


##########
providers/openlineage/src/airflow/providers/openlineage/utils/utils.py:
##########
@@ -1073,18 +1080,27 @@ def team_name(cls, dagrun: DagRun) -> str | None:
         if hasattr(dagrun, "team_name"):
             return dagrun.team_name
 
+        # Best-effort: the scheduler stamps `_team_name` on ORM DagRun objects 
before
+        # listener hooks fire. It's a private attribute with no stability 
guarantee,
+        # so guard with hasattr and an isinstance check.
+        if hasattr(dagrun, "_team_name"):
+            return dagrun._team_name if isinstance(dagrun._team_name, str) 
else None
+
         try:
-            bundle_name = cls.dag_version_info(dagrun, "bundle_name")
-            if not isinstance(bundle_name, str):
+            from sqlalchemy.orm import object_session
+
+            session = object_session(dagrun)

Review Comment:
   Added a comment there, thanks



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