4141 PREPULL_COMMAND_NAME ,
4242)
4343from ...core .settings import get_application_settings
44- from ...models import BufferPool , BufferPoolManager
44+ from ...models import WarmBufferPool , WarmBufferPoolManager
4545from ...utils .warm_buffer_machines import (
4646 dump_pre_pulled_images_as_tags ,
4747 ec2_buffer_startup_script ,
5757
5858
5959async 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
112112async 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
150150async 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
179179async 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
213213async 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
227227async 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
294294async 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
362362async 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 ()
0 commit comments