Skip to content

Commit 6083c55

Browse files
committed
renaming
1 parent 4994dbf commit 6083c55

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
)
5454
from ...utils.warm_buffer_machines import (
5555
get_activated_warm_buffer_ec2_tags,
56-
get_deactivated_buffer_ec2_tags,
56+
get_deactivated_warm_buffer_ec2_tags,
5757
is_warm_buffer_machine,
5858
)
5959
from ..docker import get_docker_client
@@ -91,7 +91,7 @@ async def _analyze_current_cluster(
9191

9292
warm_buffer_ec2_instances = await get_ec2_client(app).get_instances(
9393
key_names=[app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_KEY_NAME],
94-
tags=get_deactivated_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
94+
tags=get_deactivated_warm_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
9595
state_names=["stopped"],
9696
)
9797

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
from ...models import WarmBufferPool, WarmBufferPoolManager
4545
from ...utils.warm_buffer_machines import (
4646
dump_pre_pulled_images_as_tags,
47-
ec2_buffer_startup_script,
48-
get_deactivated_buffer_ec2_tags,
47+
ec2_warm_buffer_startup_script,
48+
get_deactivated_warm_buffer_ec2_tags,
4949
load_pre_pulled_images_from_tags,
5050
)
5151
from ..ec2 import get_ec2_client
@@ -156,7 +156,7 @@ async def _analyse_current_state(
156156

157157
all_buffer_instances = await ec2_client.get_instances(
158158
key_names=[app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_KEY_NAME],
159-
tags=get_deactivated_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
159+
tags=get_deactivated_warm_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
160160
state_names=["stopped", "pending", "running", "stopping"],
161161
)
162162
buffers_manager = WarmBufferPoolManager()
@@ -302,10 +302,10 @@ async def _add_remove_buffer_instances(
302302
name=ec2_type,
303303
resources=Resources.create_as_empty(), # fake resources
304304
),
305-
tags=get_deactivated_buffer_ec2_tags(
305+
tags=get_deactivated_warm_buffer_ec2_tags(
306306
auto_scaling_mode.get_ec2_tags(app)
307307
),
308-
startup_script=ec2_buffer_startup_script(
308+
startup_script=ec2_warm_buffer_startup_script(
309309
ec2_boot_specific, app_settings
310310
),
311311
ami_id=ec2_boot_specific.ami_id,

services/autoscaling/src/simcore_service_autoscaling/utils/warm_buffer_machines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_activated_warm_buffer_ec2_tags(base_ec2_tags: EC2Tags) -> EC2Tags:
2525
return base_ec2_tags | ACTIVATED_BUFFER_MACHINE_EC2_TAGS
2626

2727

28-
def get_deactivated_buffer_ec2_tags(base_ec2_tags: EC2Tags) -> EC2Tags:
28+
def get_deactivated_warm_buffer_ec2_tags(base_ec2_tags: EC2Tags) -> EC2Tags:
2929
new_base_ec2_tags = base_ec2_tags | DEACTIVATED_BUFFER_MACHINE_EC2_TAGS
3030
new_base_ec2_tags[_NAME_EC2_TAG_KEY] = TypeAdapter(AWSTagValue).validate_python(
3131
f"{new_base_ec2_tags[_NAME_EC2_TAG_KEY]}-buffer"
@@ -90,7 +90,7 @@ def load_pre_pulled_images_from_tags(tags: EC2Tags) -> list[DockerGenericTag]:
9090
return []
9191

9292

93-
def ec2_buffer_startup_script(
93+
def ec2_warm_buffer_startup_script(
9494
ec2_boot_specific: EC2InstanceBootSpecific, app_settings: ApplicationSettings
9595
) -> str:
9696
startup_commands = ec2_boot_specific.custom_boot_scripts.copy()

services/autoscaling/tests/unit/conftest.py

Lines changed: 18 additions & 18 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
@@ -87,7 +89,7 @@
8789
_OSPARC_SERVICES_READY_DATETIME_LABEL_KEY,
8890
)
8991
from simcore_service_autoscaling.utils.warm_buffer_machines import (
90-
get_deactivated_buffer_ec2_tags,
92+
get_deactivated_warm_buffer_ec2_tags,
9193
)
9294
from tenacity import after_log, before_sleep_log, retry
9395
from tenacity.retry import retry_if_exception_type
@@ -753,9 +755,9 @@ async def _() -> None:
753755
assert tasks, f"no tasks available for {found_service['Spec']['Name']}"
754756
assert len(tasks) == 1
755757
service_task = tasks[0]
756-
assert service_task["Status"]["State"] in expected_states, (
757-
f"service {found_service['Spec']['Name']}'s task is {service_task['Status']['State']}"
758-
)
758+
assert (
759+
service_task["Status"]["State"] in expected_states
760+
), f"service {found_service['Spec']['Name']}'s task is {service_task['Status']['State']}"
759761
ctx.logger.info(
760762
"%s",
761763
f"service {found_service['Spec']['Name']} is now {service_task['Status']['State']} {'.' * number_of_success['count']}",
@@ -982,9 +984,7 @@ def _creator(
982984
assert (
983985
datetime.timedelta(seconds=10)
984986
< app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_TIME_BEFORE_TERMINATION
985-
), (
986-
"this tests relies on the fact that the time before termination is above 10 seconds"
987-
)
987+
), "this tests relies on the fact that the time before termination is above 10 seconds"
988988
assert app_settings.AUTOSCALING_EC2_INSTANCES
989989
seconds_delta = (
990990
-datetime.timedelta(seconds=10)
@@ -1125,12 +1125,12 @@ def ec2_instances_allowed_types_with_only_1_buffered(
11251125
allowed_ec2_types.items(),
11261126
)
11271127
)
1128-
assert allowed_ec2_types_with_buffer_defined, (
1129-
"one type with buffer is needed for the tests!"
1130-
)
1131-
assert len(allowed_ec2_types_with_buffer_defined) == 1, (
1132-
"more than one type with buffer is disallowed in this test!"
1133-
)
1128+
assert (
1129+
allowed_ec2_types_with_buffer_defined
1130+
), "one type with buffer is needed for the tests!"
1131+
assert (
1132+
len(allowed_ec2_types_with_buffer_defined) == 1
1133+
), "more than one type with buffer is disallowed in this test!"
11341134
return {
11351135
TypeAdapter(InstanceTypeType).validate_python(k): v
11361136
for k, v in allowed_ec2_types_with_buffer_defined.items()
@@ -1154,9 +1154,9 @@ def _by_buffer_count(
11541154
filter(_by_buffer_count, allowed_ec2_types.items())
11551155
)
11561156
assert allowed_ec2_types_with_buffer_defined, "you need one type with buffer"
1157-
assert len(allowed_ec2_types_with_buffer_defined) == 1, (
1158-
"more than one type with buffer is disallowed in this test!"
1159-
)
1157+
assert (
1158+
len(allowed_ec2_types_with_buffer_defined) == 1
1159+
), "more than one type with buffer is disallowed in this test!"
11601160
return next(iter(allowed_ec2_types_with_buffer_defined.values())).buffer_count
11611161

11621162

@@ -1185,7 +1185,7 @@ async def _do(
11851185

11861186
resource_tags: list[TagTypeDef] = [
11871187
{"Key": tag_key, "Value": tag_value}
1188-
for tag_key, tag_value in get_deactivated_buffer_ec2_tags(
1188+
for tag_key, tag_value in get_deactivated_warm_buffer_ec2_tags(
11891189
DynamicAutoscalingProvider().get_ec2_tags(initialized_app)
11901190
).items()
11911191
]

services/autoscaling/tests/unit/test_utils_warm_buffer_machines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from simcore_service_autoscaling.utils.warm_buffer_machines import (
2424
dump_pre_pulled_images_as_tags,
2525
get_activated_warm_buffer_ec2_tags,
26-
get_deactivated_buffer_ec2_tags,
26+
get_deactivated_warm_buffer_ec2_tags,
2727
is_warm_buffer_machine,
2828
load_pre_pulled_images_from_tags,
2929
)
@@ -56,7 +56,7 @@ def test_get_deactivated_buffer_ec2_tags_dynamic(
5656
initialized_app: FastAPI,
5757
):
5858
auto_scaling_mode = DynamicAutoscalingProvider()
59-
deactivated_buffer_tags = get_deactivated_buffer_ec2_tags(
59+
deactivated_buffer_tags = get_deactivated_warm_buffer_ec2_tags(
6060
auto_scaling_mode.get_ec2_tags(initialized_app)
6161
)
6262
# when deactivated the buffer EC2 name has an additional -buffer suffix
@@ -98,7 +98,7 @@ def test_get_deactivated_buffer_ec2_tags_computational(
9898
initialized_app: FastAPI,
9999
):
100100
auto_scaling_mode = ComputationalAutoscalingProvider()
101-
deactivated_buffer_tags = get_deactivated_buffer_ec2_tags(
101+
deactivated_buffer_tags = get_deactivated_warm_buffer_ec2_tags(
102102
auto_scaling_mode.get_ec2_tags(initialized_app)
103103
)
104104
# when deactivated the buffer EC2 name has an additional -buffer suffix

0 commit comments

Comments
 (0)