vincbeck commented on code in PR #73154:
URL: https://github.com/apache/airflow/pull/73154#discussion_r4018780239


##########
airflow-core/src/airflow/dag_processing/bundles/manager.py:
##########
@@ -343,15 +343,21 @@ def _extract_and_sign_template(bundle_name: str) -> 
tuple[str | None, dict]:
             return new_template_, new_params_
 
         stored = {b.name: b for b in 
session.scalars(select(DagBundleModel)).all()}
-        bundle_to_team = {
-            bundle.name: bundle.teams[0].name if len(bundle.teams) == 1 else 
None
-            for bundle in stored.values()
-        }
+        bundle_to_team = DagBundleModel.get_team_names(stored.keys(), 
session=session)

Review Comment:
   This should only be done if the environment is in multi team set up



##########
airflow-core/src/airflow/dag_processing/bundles/manager.py:
##########
@@ -343,15 +343,21 @@ def _extract_and_sign_template(bundle_name: str) -> 
tuple[str | None, dict]:
             return new_template_, new_params_
 
         stored = {b.name: b for b in 
session.scalars(select(DagBundleModel)).all()}
-        bundle_to_team = {
-            bundle.name: bundle.teams[0].name if len(bundle.teams) == 1 else 
None
-            for bundle in stored.values()
-        }
+        bundle_to_team = DagBundleModel.get_team_names(stored.keys(), 
session=session)
+
+        teams_by_name: dict[str, Team] = {}
+        if configured_team_names := {
+            config.team_name for config in self._bundle_config.values() if 
config.team_name
+        }:
+            teams_by_name = {
+                team.name: team
+                for team in 
session.scalars(select(Team).where(Team.name.in_(configured_team_names)))
+            }

Review Comment:
   Not sure what you are doing here. You are looking for teams even though we 
already fetched them?



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