Skip to content

Commit de8d8c8

Browse files
committed
renaming
1 parent 5895ce0 commit de8d8c8

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

services/autoscaling/src/simcore_service_autoscaling/models.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class DaskTask:
158158

159159

160160
@dataclass(kw_only=True, slots=True)
161-
class BufferPool:
161+
class WarmBufferPool:
162162
ready_instances: set[EC2InstanceData] = field(default_factory=set)
163163
pending_instances: set[EC2InstanceData] = field(default_factory=set)
164164
waiting_to_pull_instances: set[EC2InstanceData] = field(default_factory=set)
@@ -169,7 +169,7 @@ class BufferPool:
169169

170170
def __repr__(self) -> str:
171171
return (
172-
f"BufferPool(ready-count={len(self.ready_instances)}, "
172+
f"WarmBufferPool(ready-count={len(self.ready_instances)}, "
173173
f"pending-count={len(self.pending_instances)}, "
174174
f"waiting-to-pull-count={len(self.waiting_to_pull_instances)}, "
175175
f"waiting-to-stop-count={len(self.waiting_to_stop_instances)}, "
@@ -212,20 +212,20 @@ def remove_instance(self, instance: EC2InstanceData) -> None:
212212

213213

214214
@dataclass
215-
class BufferPoolManager:
216-
buffer_pools: dict[InstanceTypeType, BufferPool] = field(
217-
default_factory=lambda: defaultdict(BufferPool)
215+
class WarmBufferPoolManager:
216+
buffer_pools: dict[InstanceTypeType, WarmBufferPool] = field(
217+
default_factory=lambda: defaultdict(WarmBufferPool)
218218
)
219219

220220
def __repr__(self) -> str:
221-
return f"BufferPoolManager({dict(self.buffer_pools)})"
221+
return f"WarmBufferPoolManager({dict(self.buffer_pools)})"
222222

223-
def flatten_buffer_pool(self) -> BufferPool:
223+
def flatten_buffer_pool(self) -> WarmBufferPool:
224224
"""returns a flattened buffer pool with all the EC2InstanceData"""
225-
flat_pool = BufferPool()
225+
flat_pool = WarmBufferPool()
226226

227227
for buffer_pool in self.buffer_pools.values():
228-
for f in fields(BufferPool):
228+
for f in fields(WarmBufferPool):
229229
getattr(flat_pool, f.name).update(getattr(buffer_pool, f.name))
230230

231231
return flat_pool

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
PREPULL_COMMAND_NAME,
4242
)
4343
from ...core.settings import get_application_settings
44-
from ...models import BufferPool, BufferPoolManager
44+
from ...models import WarmBufferPool, WarmBufferPoolManager
4545
from ...utils.warm_buffer_machines import (
4646
dump_pre_pulled_images_as_tags,
4747
ec2_buffer_startup_script,
@@ -57,7 +57,7 @@
5757

5858

5959
async def _analyze_running_instance_state(
60-
app: FastAPI, *, buffer_pool: BufferPool, instance: EC2InstanceData
60+
app: FastAPI, *, buffer_pool: WarmBufferPool, instance: EC2InstanceData
6161
):
6262
ssm_client = get_ssm_client(app)
6363
app_settings = get_application_settings(app)
@@ -111,7 +111,7 @@ async def _analyze_running_instance_state(
111111

112112
async def _analyse_current_state(
113113
app: FastAPI, *, auto_scaling_mode: AutoscalingProvider
114-
) -> BufferPoolManager:
114+
) -> WarmBufferPoolManager:
115115
ec2_client = get_ec2_client(app)
116116
app_settings = get_application_settings(app)
117117
assert app_settings.AUTOSCALING_EC2_INSTANCES # nosec
@@ -121,7 +121,7 @@ async def _analyse_current_state(
121121
tags=get_deactivated_buffer_ec2_tags(auto_scaling_mode.get_ec2_tags(app)),
122122
state_names=["stopped", "pending", "running", "stopping"],
123123
)
124-
buffers_manager = BufferPoolManager()
124+
buffers_manager = WarmBufferPoolManager()
125125
for instance in all_buffer_instances:
126126
match instance.state:
127127
case "stopped":
@@ -149,8 +149,8 @@ async def _analyse_current_state(
149149

150150
async def _terminate_unneeded_pools(
151151
app: FastAPI,
152-
buffers_manager: BufferPoolManager,
153-
) -> BufferPoolManager:
152+
buffers_manager: WarmBufferPoolManager,
153+
) -> WarmBufferPoolManager:
154154
ec2_client = get_ec2_client(app)
155155
app_settings = get_application_settings(app)
156156
assert app_settings.AUTOSCALING_EC2_INSTANCES # nosec
@@ -177,8 +177,8 @@ async def _terminate_unneeded_pools(
177177

178178

179179
async def _terminate_instances_with_invalid_pre_pulled_images(
180-
app: FastAPI, buffers_manager: BufferPoolManager
181-
) -> BufferPoolManager:
180+
app: FastAPI, buffers_manager: WarmBufferPoolManager
181+
) -> WarmBufferPoolManager:
182182
ec2_client = get_ec2_client(app)
183183
app_settings = get_application_settings(app)
184184
assert app_settings.AUTOSCALING_EC2_INSTANCES # nosec
@@ -211,8 +211,8 @@ async def _terminate_instances_with_invalid_pre_pulled_images(
211211

212212

213213
async def _terminate_broken_instances(
214-
app: FastAPI, buffers_manager: BufferPoolManager
215-
) -> BufferPoolManager:
214+
app: FastAPI, buffers_manager: WarmBufferPoolManager
215+
) -> WarmBufferPoolManager:
216216
ec2_client = get_ec2_client(app)
217217
termineatable_instances = set()
218218
for pool in buffers_manager.buffer_pools.values():
@@ -226,10 +226,10 @@ async def _terminate_broken_instances(
226226

227227
async def _add_remove_buffer_instances(
228228
app: FastAPI,
229-
buffers_manager: BufferPoolManager,
229+
buffers_manager: WarmBufferPoolManager,
230230
*,
231231
auto_scaling_mode: AutoscalingProvider,
232-
) -> BufferPoolManager:
232+
) -> WarmBufferPoolManager:
233233
ec2_client = get_ec2_client(app)
234234
app_settings = get_application_settings(app)
235235
assert app_settings.AUTOSCALING_EC2_INSTANCES # nosec
@@ -292,7 +292,7 @@ async def _add_remove_buffer_instances(
292292

293293

294294
async def _handle_pool_image_pulling(
295-
app: FastAPI, instance_type: InstanceTypeType, pool: BufferPool
295+
app: FastAPI, instance_type: InstanceTypeType, pool: WarmBufferPool
296296
) -> tuple[InstancesToStop, InstancesToTerminate]:
297297
ec2_client = get_ec2_client(app)
298298
ssm_client = get_ssm_client(app)
@@ -360,7 +360,7 @@ async def _handle_pool_image_pulling(
360360

361361

362362
async def _handle_image_pre_pulling(
363-
app: FastAPI, buffers_manager: BufferPoolManager
363+
app: FastAPI, buffers_manager: WarmBufferPoolManager
364364
) -> None:
365365
ec2_client = get_ec2_client(app)
366366
instances_to_stop: set[EC2InstanceData] = set()

services/autoscaling/src/simcore_service_autoscaling/modules/instrumentation/_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from prometheus_client import CollectorRegistry, Counter, Histogram
55
from servicelib.instrumentation import MetricsBase
66

7-
from ...models import BufferPoolManager, Cluster
7+
from ...models import Cluster, WarmBufferPoolManager
88
from ._constants import (
99
BUFFER_POOLS_METRICS_DEFINITIONS,
1010
CLUSTER_METRICS_DEFINITIONS,
@@ -165,7 +165,7 @@ def __post_init__(self) -> None:
165165
)
166166

167167
def update_from_buffer_pool_manager(
168-
self, buffer_pool_manager: BufferPoolManager
168+
self, buffer_pool_manager: WarmBufferPoolManager
169169
) -> None:
170170
flat_pool = buffer_pool_manager.flatten_buffer_pool()
171171

0 commit comments

Comments
 (0)