Skip to content

Commit e09f505

Browse files
committed
ongoing
1 parent b7026fd commit e09f505

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,26 @@ async def _activate_drained_nodes(
418418
)
419419

420420

421-
async def _start_buffer_instances(
421+
async def _start_warm_buffer_instances(
422422
app: FastAPI, cluster: Cluster, auto_scaling_mode: BaseAutoscaling
423423
) -> Cluster:
424+
"""starts warm buffer if there are assigned tasks, or if a hot buffer of the same type is needed"""
425+
426+
app_settings = get_application_settings(app)
427+
needed_hot_buffers = (
428+
app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_MACHINES_BUFFER
429+
)
430+
hot_buffer_instance_type = next(
431+
iter(app_settings.AUTOSCALING_EC2_INSTANCES.EC2_INSTANCES_ALLOWED_TYPES)
432+
)
433+
current_hot_buffers = cluster.buffer_drained_nodes
434+
424435
instances_to_start = [
425436
i.ec2_instance for i in cluster.buffer_ec2s if i.assigned_tasks
426437
]
427438
if not instances_to_start:
428439
return cluster
429-
# change the buffer machine to an active one
440+
430441
with log_context(
431442
_logger, logging.INFO, f"start {len(instances_to_start)} buffer machines"
432443
):
@@ -1187,8 +1198,8 @@ async def _autoscale_cluster(
11871198
# 2. activate available drained nodes to cover some of the tasks
11881199
cluster = await _activate_drained_nodes(app, cluster, auto_scaling_mode)
11891200

1190-
# 3. start buffer instances to cover the remaining tasks
1191-
cluster = await _start_buffer_instances(app, cluster, auto_scaling_mode)
1201+
# 3. start warm buffer instances to cover the remaining tasks
1202+
cluster = await _start_warm_buffer_instances(app, cluster, auto_scaling_mode)
11921203

11931204
# 4. scale down unused instances
11941205
cluster = await _scale_down_unused_cluster_instances(

0 commit comments

Comments
 (0)