anishgirianish commented on code in PR #63491:
URL: https://github.com/apache/airflow/pull/63491#discussion_r3336122604
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/local_kubernetes_executor.py:
##########
@@ -144,7 +135,9 @@ def slots_available(self) -> int:
@property
def slots_occupied(self):
"""Number of tasks this executor instance is currently managing."""
- return len(self.running) + len(self.queued_tasks)
+ return (
+ self.local_executor.slots_occupied +
self.kubernetes_executor.slots_occupied - len(self.running)
Review Comment:
Done thank you
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/executors/test_local_kubernetes_executor.py:
##########
@@ -51,21 +51,18 @@ def test_serve_logs_default_value(self):
def test_cli_commands_vended(self):
assert LocalKubernetesExecutor.get_cli_commands()
- def test_queued_tasks(self):
+ def test_slots_occupied_sums_children_without_deprecation(self):
local_executor_mock = mock.MagicMock()
k8s_executor_mock = mock.MagicMock()
- local_kubernetes_executor =
LocalKubernetesExecutor(local_executor_mock, k8s_executor_mock)
-
- local_queued_tasks = {("dag_id", "task_id", "2020-08-30", 1):
"queued_command"}
- k8s_queued_tasks = {("dag_id_2", "task_id_2", "2020-08-30", 2):
"queued_command"}
+ local_executor_mock.slots_occupied = 3
+ k8s_executor_mock.slots_occupied = 2
+ local_executor_mock.running = {("dag_id", "task_id", "2020-08-30", 1)}
+ k8s_executor_mock.running = set()
- local_executor_mock.queued_tasks = local_queued_tasks
- k8s_executor_mock.queued_tasks = k8s_queued_tasks
-
- expected_queued_tasks = {**local_queued_tasks, **k8s_queued_tasks}
+ local_kubernetes_executor =
LocalKubernetesExecutor(local_executor_mock, k8s_executor_mock)
- assert local_kubernetes_executor.queued_tasks == expected_queued_tasks
- assert len(local_kubernetes_executor.queued_tasks) == 2
+ assert local_kubernetes_executor.slots_occupied == 4
Review Comment:
updated thank you
--
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]