SameerMesiah97 commented on code in PR #69768:
URL: https://github.com/apache/airflow/pull/69768#discussion_r3642164610
##########
airflow-core/src/airflow/dag_processing/dagbag.py:
##########
@@ -161,6 +162,30 @@ def _validate_executor_fields(dag: DAG, bundle_name: str |
None = None) -> None:
)
+def _assign_default_team_pools(
+ dag: DAG,
+ bundle_name: str | None = None,
+) -> None:
+ """Assign the default team pool to tasks that do not explicitly specify a
pool."""
+ dag_team_name = None
+
+ if conf.getboolean("core", "multi_team"):
+ if bundle_name:
+ from airflow.dag_processing.bundles.manager import
DagBundlesManager
+
+ bundle_manager = DagBundlesManager()
+ bundle_config = bundle_manager._bundle_config[bundle_name]
+
+ dag_team_name = bundle_config.team_name
+
+ if not dag_team_name:
+ return
Review Comment:
I considered extracting a helper, but it would end up being 10 lines at most
and it would only be used in 2 places. Also, I felt keeping the logic inline
made each function a little easier to follow. That being said, I'm happy to
extract it if you think we'll be reusing it elsewhere but I dont see the need
for it right now.
##########
airflow-core/tests/unit/cli/commands/test_team_command.py:
##########
@@ -79,6 +79,25 @@ def test_team_create_success(self, stdout_capture):
assert "Team 'test-team' created successfully" in output
assert str(team.name) in output
+ def test_team_create_creates_default_pool(self, stdout_capture):
+ """Test that creating a team also creates its default pool."""
+ with conf_vars(
+ {
+ ("core", "multi_team"): "True",
+ ("multi_team", "default_pool_task_slot_count"): "128",
Review Comment:
Done.
--
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]