Skip to content

Commit d52471c

Browse files
committed
renamed provider for dynamic
1 parent fb93328 commit d52471c

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ..redis import get_redis_client
1313
from ._auto_scaling_core import auto_scale_cluster
1414
from ._provider_computational import ComputationalAutoscaling
15-
from .auto_scaling_mode_dynamic import DynamicAutoscaling
15+
from ._provider_dynamic import DynamicAutoscaling
1616

1717
_TASK_NAME: Final[str] = "Autoscaling EC2 instances"
1818

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from ...utils.redis import create_lock_key_and_value
1212
from ..redis import get_redis_client
1313
from ._buffer_machines_pool_core import monitor_buffer_machines
14-
from .auto_scaling_mode_dynamic import DynamicAutoscaling
14+
from ._provider_dynamic import DynamicAutoscaling
1515

1616
_TASK_NAME_BUFFER: Final[str] = "Autoscaling Buffer Machines Pool"
1717

services/autoscaling/tests/unit/conftest.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
)
4141
from models_library.generated_models.docker_rest_api import (
4242
Availability,
43+
)
44+
from models_library.generated_models.docker_rest_api import Node as DockerNode
45+
from models_library.generated_models.docker_rest_api import (
4346
NodeDescription,
4447
NodeSpec,
4548
NodeState,
@@ -49,7 +52,6 @@
4952
Service,
5053
TaskSpec,
5154
)
52-
from models_library.generated_models.docker_rest_api import Node as DockerNode
5355
from pydantic import ByteSize, NonNegativeInt, PositiveInt, TypeAdapter
5456
from pytest_mock import MockType
5557
from pytest_mock.plugin import MockerFixture
@@ -77,7 +79,7 @@
7779
DaskTaskResources,
7880
)
7981
from simcore_service_autoscaling.modules.cluster_scaling import _auto_scaling_core
80-
from simcore_service_autoscaling.modules.cluster_scaling.auto_scaling_mode_dynamic import (
82+
from simcore_service_autoscaling.modules.cluster_scaling._provider_dynamic import (
8183
DynamicAutoscaling,
8284
)
8385
from simcore_service_autoscaling.modules.docker import AutoscalingDocker
@@ -752,9 +754,9 @@ async def _() -> None:
752754
assert tasks, f"no tasks available for {found_service['Spec']['Name']}"
753755
assert len(tasks) == 1
754756
service_task = tasks[0]
755-
assert service_task["Status"]["State"] in expected_states, (
756-
f"service {found_service['Spec']['Name']}'s task is {service_task['Status']['State']}"
757-
)
757+
assert (
758+
service_task["Status"]["State"] in expected_states
759+
), f"service {found_service['Spec']['Name']}'s task is {service_task['Status']['State']}"
758760
ctx.logger.info(
759761
"%s",
760762
f"service {found_service['Spec']['Name']} is now {service_task['Status']['State']} {'.' * number_of_success['count']}",
@@ -981,9 +983,7 @@ def _creator(
981983
assert (
982984
datetime.timedelta(seconds=10)
983985
< app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_TIME_BEFORE_TERMINATION
984-
), (
985-
"this tests relies on the fact that the time before termination is above 10 seconds"
986-
)
986+
), "this tests relies on the fact that the time before termination is above 10 seconds"
987987
assert app_settings.AUTOSCALING_EC2_INSTANCES
988988
seconds_delta = (
989989
-datetime.timedelta(seconds=10)
@@ -1124,12 +1124,12 @@ def ec2_instances_allowed_types_with_only_1_buffered(
11241124
allowed_ec2_types.items(),
11251125
)
11261126
)
1127-
assert allowed_ec2_types_with_buffer_defined, (
1128-
"one type with buffer is needed for the tests!"
1129-
)
1130-
assert len(allowed_ec2_types_with_buffer_defined) == 1, (
1131-
"more than one type with buffer is disallowed in this test!"
1132-
)
1127+
assert (
1128+
allowed_ec2_types_with_buffer_defined
1129+
), "one type with buffer is needed for the tests!"
1130+
assert (
1131+
len(allowed_ec2_types_with_buffer_defined) == 1
1132+
), "more than one type with buffer is disallowed in this test!"
11331133
return {
11341134
TypeAdapter(InstanceTypeType).validate_python(k): v
11351135
for k, v in allowed_ec2_types_with_buffer_defined.items()
@@ -1153,9 +1153,9 @@ def _by_buffer_count(
11531153
filter(_by_buffer_count, allowed_ec2_types.items())
11541154
)
11551155
assert allowed_ec2_types_with_buffer_defined, "you need one type with buffer"
1156-
assert len(allowed_ec2_types_with_buffer_defined) == 1, (
1157-
"more than one type with buffer is disallowed in this test!"
1158-
)
1156+
assert (
1157+
len(allowed_ec2_types_with_buffer_defined) == 1
1158+
), "more than one type with buffer is disallowed in this test!"
11591159
return next(iter(allowed_ec2_types_with_buffer_defined.values())).buffer_count
11601160

11611161

services/autoscaling/tests/unit/test_modules_auto_scaling_dynamic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
_try_scale_down_cluster,
6060
auto_scale_cluster,
6161
)
62-
from simcore_service_autoscaling.modules.cluster_scaling.auto_scaling_mode_dynamic import (
62+
from simcore_service_autoscaling.modules.cluster_scaling._provider_dynamic import (
6363
DynamicAutoscaling,
6464
)
6565
from simcore_service_autoscaling.modules.docker import (

services/autoscaling/tests/unit/test_modules_buffer_machine_core.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from simcore_service_autoscaling.modules.cluster_scaling._buffer_machines_pool_core import (
3232
monitor_buffer_machines,
3333
)
34-
from simcore_service_autoscaling.modules.cluster_scaling.auto_scaling_mode_dynamic import (
34+
from simcore_service_autoscaling.modules.cluster_scaling._provider_dynamic import (
3535
DynamicAutoscaling,
3636
)
3737
from types_aiobotocore_ec2 import EC2Client
@@ -161,9 +161,9 @@ async def _test_monitor_buffer_machines(
161161
):
162162
# 0. we have no instances now
163163
all_instances = await ec2_client.describe_instances(Filters=instance_type_filters)
164-
assert not all_instances["Reservations"], (
165-
f"There should be no instances at the start of the test. Found following instance ids: {[i['InstanceId'] for r in all_instances['Reservations'] if 'Instances' in r for i in r['Instances'] if 'InstanceId' in i]}"
166-
)
164+
assert not all_instances[
165+
"Reservations"
166+
], f"There should be no instances at the start of the test. Found following instance ids: {[i['InstanceId'] for r in all_instances['Reservations'] if 'Instances' in r for i in r['Instances'] if 'InstanceId' in i]}"
167167

168168
# 1. run, this will create as many buffer machines as needed
169169
with log_context(logging.INFO, "create buffer machines"):
@@ -388,9 +388,9 @@ async def test_monitor_buffer_machines_terminates_instances_with_incorrect_pre_p
388388
],
389389
):
390390
# have machines of correct type with missing pre-pulled images
391-
assert len(pre_pull_images) > 1, (
392-
"this test relies on pre-pulled images being filled with more than 1 image"
393-
)
391+
assert (
392+
len(pre_pull_images) > 1
393+
), "this test relies on pre-pulled images being filled with more than 1 image"
394394
buffer_machines = await create_buffer_machines(
395395
buffer_count + 5,
396396
next(iter(list(ec2_instances_allowed_types_with_only_1_buffered))),
@@ -520,9 +520,9 @@ def pre_pull_images(
520520
allowed_ec2_types.items(),
521521
)
522522
)
523-
assert len(allowed_ec2_types_with_pre_pull_images_defined) <= 1, (
524-
"more than one type with pre-pulled-images is disallowed in this test!"
525-
)
523+
assert (
524+
len(allowed_ec2_types_with_pre_pull_images_defined) <= 1
525+
), "more than one type with pre-pulled-images is disallowed in this test!"
526526

527527
if allowed_ec2_types_with_pre_pull_images_defined:
528528
return next(

services/autoscaling/tests/unit/test_utils_buffer_machines_pool_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from simcore_service_autoscaling.modules.cluster_scaling._provider_computational import (
1818
ComputationalAutoscaling,
1919
)
20-
from simcore_service_autoscaling.modules.cluster_scaling.auto_scaling_mode_dynamic import (
20+
from simcore_service_autoscaling.modules.cluster_scaling._provider_dynamic import (
2121
DynamicAutoscaling,
2222
)
2323
from simcore_service_autoscaling.utils.buffer_machines_pool_core import (

0 commit comments

Comments
 (0)