Skip to content

Commit a578144

Browse files
committed
renaming utils
1 parent 734dc72 commit a578144

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

services/autoscaling/src/simcore_service_autoscaling/modules/cluster_scaling/_auto_scaling_core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@
3939
NonAssociatedInstance,
4040
)
4141
from ...utils import utils_docker, utils_ec2
42-
from ...utils.auto_scaling_core import (
42+
from ...utils.buffer_machines import (
43+
get_activated_buffer_ec2_tags,
44+
get_deactivated_buffer_ec2_tags,
45+
is_buffer_machine,
46+
)
47+
from ...utils.cluster_scaling import (
4348
associate_ec2_instances_with_nodes,
4449
ec2_startup_script,
4550
find_selected_instance_type_for_task,
4651
get_machine_buffer_type,
4752
node_host_name_from_ec2_private_dns,
4853
sort_drained_nodes,
4954
)
50-
from ...utils.buffer_machines_pool_core import (
51-
get_activated_buffer_ec2_tags,
52-
get_deactivated_buffer_ec2_tags,
53-
is_buffer_machine,
54-
)
5555
from ...utils.rabbitmq import (
5656
post_autoscaling_status_message,
5757
post_tasks_log_message,

services/autoscaling/src/simcore_service_autoscaling/modules/cluster_scaling/_buffer_machines_pool_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
)
4444
from ...core.settings import get_application_settings
4545
from ...models import BufferPool, BufferPoolManager
46-
from ...utils.auto_scaling_core import ec2_buffer_startup_script
47-
from ...utils.buffer_machines_pool_core import (
46+
from ...utils.buffer_machines import (
4847
dump_pre_pulled_images_as_tags,
4948
get_deactivated_buffer_ec2_tags,
5049
load_pre_pulled_images_from_tags,
5150
)
51+
from ...utils.cluster_scaling import ec2_buffer_startup_script
5252
from ..ec2 import get_ec2_client
5353
from ..instrumentation import get_instrumentation, has_instrumentation
5454
from ..ssm import get_ssm_client

services/autoscaling/src/simcore_service_autoscaling/modules/dask.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
DaskWorkerNotFoundError,
2222
)
2323
from ..models import AssociatedInstance, DaskTask, DaskTaskId
24-
from ..utils.auto_scaling_core import (
24+
from ..utils.cluster_scaling import (
2525
node_host_name_from_ec2_private_dns,
2626
node_ip_from_ec2_private_dns,
2727
)
@@ -30,7 +30,7 @@
3030

3131

3232
async def _wrap_client_async_routine(
33-
client_coroutine: Coroutine[Any, Any, Any] | Any | None
33+
client_coroutine: Coroutine[Any, Any, Any] | Any | None,
3434
) -> Any:
3535
"""Dask async behavior does not go well with Pylance as it returns
3636
a union of types. this wrapper makes both mypy and pylance happy"""
@@ -96,7 +96,7 @@ def _dask_worker_from_ec2_instance(
9696

9797
# dict is of type dask_worker_address: worker_details
9898
def _find_by_worker_host(
99-
dask_worker: tuple[DaskWorkerUrl, DaskWorkerDetails]
99+
dask_worker: tuple[DaskWorkerUrl, DaskWorkerDetails],
100100
) -> bool:
101101
_, details = dask_worker
102102
if match := re.match(DASK_NAME_PATTERN, details["name"]):
@@ -173,9 +173,9 @@ def _list_tasks(
173173
}
174174

175175
async with _scheduler_client(scheduler_url, authentication) as client:
176-
list_of_tasks: dict[
177-
dask.typing.Key, DaskTaskResources
178-
] = await _wrap_client_async_routine(client.run_on_scheduler(_list_tasks))
176+
list_of_tasks: dict[dask.typing.Key, DaskTaskResources] = (
177+
await _wrap_client_async_routine(client.run_on_scheduler(_list_tasks))
178+
)
179179
_logger.debug("found unrunnable tasks: %s", list_of_tasks)
180180
return [
181181
DaskTask(
@@ -207,10 +207,10 @@ def _list_processing_tasks(
207207
return worker_to_processing_tasks
208208

209209
async with _scheduler_client(scheduler_url, authentication) as client:
210-
worker_to_tasks: dict[
211-
str, list[tuple[dask.typing.Key, DaskTaskResources]]
212-
] = await _wrap_client_async_routine(
213-
client.run_on_scheduler(_list_processing_tasks)
210+
worker_to_tasks: dict[str, list[tuple[dask.typing.Key, DaskTaskResources]]] = (
211+
await _wrap_client_async_routine(
212+
client.run_on_scheduler(_list_processing_tasks)
213+
)
214214
)
215215
_logger.debug("found processing tasks: %s", worker_to_tasks)
216216
tasks_per_worker = defaultdict(list)
@@ -276,12 +276,12 @@ def _list_processing_tasks_on_worker(
276276
_logger.debug("looking for processing tasks for %s", f"{worker_url=}")
277277

278278
# now get the used resources
279-
worker_processing_tasks: list[
280-
tuple[dask.typing.Key, DaskTaskResources]
281-
] = await _wrap_client_async_routine(
282-
client.run_on_scheduler(
283-
_list_processing_tasks_on_worker, worker_url=worker_url
284-
),
279+
worker_processing_tasks: list[tuple[dask.typing.Key, DaskTaskResources]] = (
280+
await _wrap_client_async_routine(
281+
client.run_on_scheduler(
282+
_list_processing_tasks_on_worker, worker_url=worker_url
283+
),
284+
)
285285
)
286286

287287
total_resources_used: collections.Counter[str] = collections.Counter()

services/autoscaling/tests/unit/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
)
8585
from simcore_service_autoscaling.modules.docker import AutoscalingDocker
8686
from simcore_service_autoscaling.modules.ec2 import SimcoreEC2API
87-
from simcore_service_autoscaling.utils.buffer_machines_pool_core import (
87+
from simcore_service_autoscaling.utils.buffer_machines import (
8888
get_deactivated_buffer_ec2_tags,
8989
)
9090
from simcore_service_autoscaling.utils.utils_docker import (

services/autoscaling/tests/unit/test_modules_cluster_scaling_dynamic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
AutoscalingDocker,
6767
get_docker_client,
6868
)
69-
from simcore_service_autoscaling.utils.auto_scaling_core import (
69+
from simcore_service_autoscaling.utils.cluster_scaling import (
7070
node_host_name_from_ec2_private_dns,
7171
)
7272
from simcore_service_autoscaling.utils.utils_docker import (

services/autoscaling/tests/unit/test_utils_buffer_machines_pool_core.py renamed to services/autoscaling/tests/unit/test_utils_buffer_machines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from simcore_service_autoscaling.modules.cluster_scaling._provider_dynamic import (
2121
DynamicAutoscalingProvider,
2222
)
23-
from simcore_service_autoscaling.utils.buffer_machines_pool_core import (
23+
from simcore_service_autoscaling.utils.buffer_machines import (
2424
dump_pre_pulled_images_as_tags,
2525
get_activated_buffer_ec2_tags,
2626
get_deactivated_buffer_ec2_tags,

services/autoscaling/tests/unit/test_utils_auto_scaling_core.py renamed to services/autoscaling/tests/unit/test_utils_cluster_scaling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from simcore_service_autoscaling.core.errors import Ec2InvalidDnsNameError
2323
from simcore_service_autoscaling.core.settings import ApplicationSettings
2424
from simcore_service_autoscaling.models import AssociatedInstance, EC2InstanceData
25-
from simcore_service_autoscaling.utils.auto_scaling_core import (
25+
from simcore_service_autoscaling.utils.cluster_scaling import (
2626
associate_ec2_instances_with_nodes,
2727
ec2_startup_script,
2828
get_machine_buffer_type,

0 commit comments

Comments
 (0)