Skip to content

Commit 4994dbf

Browse files
committed
renaming
1 parent ffdaf5e commit 4994dbf

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
post_tasks_progress_message,
5353
)
5454
from ...utils.warm_buffer_machines import (
55-
get_activated_buffer_ec2_tags,
55+
get_activated_warm_buffer_ec2_tags,
5656
get_deactivated_buffer_ec2_tags,
5757
is_warm_buffer_machine,
5858
)
@@ -89,7 +89,7 @@ async def _analyze_current_cluster(
8989
state_names=["terminated"],
9090
)
9191

92-
buffer_ec2_instances = await get_ec2_client(app).get_instances(
92+
warm_buffer_ec2_instances = await get_ec2_client(app).get_instances(
9393
key_names=[app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_KEY_NAME],
9494
tags=get_deactivated_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
9595
state_names=["stopped"],
@@ -154,7 +154,7 @@ async def _analyze_current_cluster(
154154
pending_ec2s=[NonAssociatedInstance(ec2_instance=i) for i in pending_ec2s],
155155
broken_ec2s=[NonAssociatedInstance(ec2_instance=i) for i in broken_ec2s],
156156
warm_buffer_ec2s=[
157-
NonAssociatedInstance(ec2_instance=i) for i in buffer_ec2_instances
157+
NonAssociatedInstance(ec2_instance=i) for i in warm_buffer_ec2_instances
158158
],
159159
terminating_nodes=terminating_nodes,
160160
terminated_instances=[
@@ -203,7 +203,7 @@ async def _terminate_broken_ec2s(app: FastAPI, cluster: Cluster) -> Cluster:
203203
)
204204

205205

206-
async def _make_pending_buffer_ec2s_join_cluster(
206+
async def _make_pending_warm_buffer_ec2s_join_cluster(
207207
app: FastAPI,
208208
cluster: Cluster,
209209
) -> Cluster:
@@ -339,10 +339,10 @@ async def _sorted_allowed_instance_types(app: FastAPI) -> list[EC2InstanceType]:
339339
allowed_instance_type_names
340340
), "EC2_INSTANCES_ALLOWED_TYPES cannot be empty!"
341341

342-
allowed_instance_types: list[
343-
EC2InstanceType
344-
] = await ec2_client.get_ec2_instance_capabilities(
345-
cast(set[InstanceTypeType], set(allowed_instance_type_names))
342+
allowed_instance_types: list[EC2InstanceType] = (
343+
await ec2_client.get_ec2_instance_capabilities(
344+
cast(set[InstanceTypeType], set(allowed_instance_type_names))
345+
)
346346
)
347347

348348
def _as_selection(instance_type: EC2InstanceType) -> int:
@@ -469,15 +469,17 @@ async def _start_warm_buffer_instances(
469469
return cluster
470470

471471
with log_context(
472-
_logger, logging.INFO, f"start {len(instances_to_start)} buffer machines"
472+
_logger, logging.INFO, f"start {len(instances_to_start)} warm buffer machines"
473473
):
474474
started_instances = await get_ec2_client(app).start_instances(
475475
instances_to_start
476476
)
477477
# NOTE: first start the instance and then set the tags in case the instance cannot start (e.g. InsufficientInstanceCapacity)
478478
await get_ec2_client(app).set_instances_tags(
479479
started_instances,
480-
tags=get_activated_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
480+
tags=get_activated_warm_buffer_ec2_tags(
481+
auto_scaling_mode.get_ec2_tags(app)
482+
),
481483
)
482484
started_instance_ids = [i.id for i in started_instances]
483485

@@ -682,7 +684,7 @@ async def _find_needed_instances(
682684
),
683685
)
684686

685-
# 2. check the buffer needs
687+
# 2. check the hot buffer needs
686688
app_settings = get_application_settings(app)
687689
assert app_settings.AUTOSCALING_EC2_INSTANCES # nosec
688690
if (
@@ -1076,9 +1078,9 @@ async def _notify_based_on_machine_type(
10761078
launch_time_to_tasks: dict[datetime.datetime, list] = collections.defaultdict(list)
10771079
now = datetime.datetime.now(datetime.UTC)
10781080
for instance in instances:
1079-
launch_time_to_tasks[instance.ec2_instance.launch_time] += (
1080-
instance.assigned_tasks
1081-
)
1081+
launch_time_to_tasks[
1082+
instance.ec2_instance.launch_time
1083+
] += instance.assigned_tasks
10821084

10831085
for launch_time, tasks in launch_time_to_tasks.items():
10841086
time_since_launch = now - launch_time
@@ -1289,7 +1291,7 @@ async def auto_scale_cluster(
12891291
# cleanup
12901292
cluster = await _cleanup_disconnected_nodes(app, cluster)
12911293
cluster = await _terminate_broken_ec2s(app, cluster)
1292-
cluster = await _make_pending_buffer_ec2s_join_cluster(app, cluster)
1294+
cluster = await _make_pending_warm_buffer_ec2s_join_cluster(app, cluster)
12931295
cluster = await _try_attach_pending_ec2s(
12941296
app, cluster, auto_scaling_mode, allowed_instance_types
12951297
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
_NAME_EC2_TAG_KEY: Final[AWSTagKey] = TypeAdapter(AWSTagKey).validate_python("Name")
2222

2323

24-
def get_activated_buffer_ec2_tags(base_ec2_tags: EC2Tags) -> EC2Tags:
24+
def get_activated_warm_buffer_ec2_tags(base_ec2_tags: EC2Tags) -> EC2Tags:
2525
return base_ec2_tags | ACTIVATED_BUFFER_MACHINE_EC2_TAGS
2626

2727

services/autoscaling/tests/unit/test_utils_warm_buffer_machines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
)
2323
from simcore_service_autoscaling.utils.warm_buffer_machines import (
2424
dump_pre_pulled_images_as_tags,
25-
get_activated_buffer_ec2_tags,
25+
get_activated_warm_buffer_ec2_tags,
2626
get_deactivated_buffer_ec2_tags,
2727
is_warm_buffer_machine,
2828
load_pre_pulled_images_from_tags,
@@ -38,7 +38,7 @@ def test_get_activated_buffer_ec2_tags_dynamic(
3838
initialized_app: FastAPI,
3939
):
4040
auto_scaling_mode = DynamicAutoscalingProvider()
41-
activated_buffer_tags = get_activated_buffer_ec2_tags(
41+
activated_buffer_tags = get_activated_warm_buffer_ec2_tags(
4242
auto_scaling_mode.get_ec2_tags(initialized_app)
4343
)
4444
assert (
@@ -80,7 +80,7 @@ def test_get_activated_buffer_ec2_tags_computational(
8080
initialized_app: FastAPI,
8181
):
8282
auto_scaling_mode = ComputationalAutoscalingProvider()
83-
activated_buffer_tags = get_activated_buffer_ec2_tags(
83+
activated_buffer_tags = get_activated_warm_buffer_ec2_tags(
8484
auto_scaling_mode.get_ec2_tags(initialized_app)
8585
)
8686
assert (

0 commit comments

Comments
 (0)