amoghrajesh commented on code in PR #68800:
URL: https://github.com/apache/airflow/pull/68800#discussion_r3498082975
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/executors/test_kubernetes_executor.py:
##########
@@ -2239,16 +2307,30 @@ def test_executor_with_team_name(self):
assert executor.team_name == "ml_team"
assert executor.kube_config is not None
+ @pytest.mark.skipif(
+ AirflowKubernetesScheduler is None, reason="kubernetes python package
is not installed"
+ )
@pytest.mark.skipif(not AIRFLOW_V_3_2_PLUS, reason="Multi-team requires
Airflow 3.2+")
- def test_multiple_team_executors_isolation(self, monkeypatch):
+
@mock.patch("airflow.providers.cncf.kubernetes.kube_client.get_kube_client")
+
@mock.patch("airflow.providers.cncf.kubernetes.executors.kubernetes_executor_utils.client")
+
@mock.patch("airflow.providers.cncf.kubernetes.executors.kubernetes_executor_utils.KubernetesJobWatcher")
+ def test_multiple_team_executors_isolation(
+ self, mock_watcher, mock_client, mock_kube_client, monkeypatch
+ ):
"""Test that multiple team executors can coexist with isolated
resources."""
monkeypatch.setenv("AIRFLOW__TEAM_A___KUBERNETES_EXECUTOR__WORKER_PODS_CREATION_BATCH_SIZE",
"4")
monkeypatch.setenv("AIRFLOW__TEAM_B___KUBERNETES_EXECUTOR__WORKER_PODS_CREATION_BATCH_SIZE",
"8")
team_a_executor = KubernetesExecutor(team_name="team_a")
team_b_executor = KubernetesExecutor(team_name="team_b")
+ team_a_executor.job_id = 1
+ team_b_executor.job_id = 2
try:
+ # Queues are created lazily in start(), so each team executor gets
its own.
Review Comment:
```suggestion
```
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/executors/test_kubernetes_executor.py:
##########
@@ -1726,6 +1728,72 @@ def test_get_task_log(self, mock_get_kube_client,
create_task_instance_of_operat
"Reading from k8s pod logs failed: error_fetching_pod_log",
]
+ def test_init_does_not_create_manager_process(self):
+ """
+ Constructing the executor must not spawn a ``multiprocessing.Manager``.
+
+ The API server builds a ``KubernetesExecutor`` purely to call
``get_task_log()`` for
+ RUNNING tasks and never starts it. Eagerly creating the Manager in
``__init__`` leaked an
+ orphaned ``serve_forever`` process per API-server worker.
+ """
Review Comment:
```suggestion
```
--
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]