SameerMesiah97 commented on code in PR #69768:
URL: https://github.com/apache/airflow/pull/69768#discussion_r3642138521
##########
airflow-core/src/airflow/cli/commands/team_command.py:
##########
@@ -172,10 +199,27 @@ def team_sync(args, *, session=NEW_SESSION):
teams_added = 0
try:
- for team_name in dag_bundle_teams -
Team.get_all_team_names(session=session):
- team = Team(name=team_name)
- session.add(team)
- teams_added += 1
+ existing_teams = Team.get_all_team_names(session=session)
+ for team_name in dag_bundle_teams:
+ if team_name not in existing_teams:
+ session.add(Team(name=team_name))
+ teams_added += 1
+
+ session.flush()
+
+ if conf.getboolean("core", "multi_team"):
+ Pool.create_or_update_pool(
+ name=Pool.get_default_team_pool_name(team_name),
+ slots=conf.getint(
+ "core",
+ "default_pool_task_slot_count",
+ ),
+ description=f"Default pool for team '{team_name}'",
+ include_deferred=False,
+ team_name=team_name,
+ session=session,
Review Comment:
A new helper `_create_default_team_pool` has been created which has the
duplicated logic. It is now being called at both relevant callsites.
--
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]