5050 auto_scale_cluster ,
5151)
5252from simcore_service_autoscaling .modules .cluster_scaling ._provider_computational import (
53- ComputationalAutoscaling ,
53+ ComputationalAutoscalingProvider ,
5454)
5555from simcore_service_autoscaling .modules .dask import DaskTaskResources
5656from simcore_service_autoscaling .modules .docker import get_docker_client
@@ -333,7 +333,7 @@ async def test_cluster_scaling_with_no_tasks_does_nothing(
333333 dask_spec_local_cluster : distributed .SpecCluster ,
334334):
335335 await auto_scale_cluster (
336- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
336+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
337337 )
338338 mock_launch_instances .assert_not_called ()
339339 mock_terminate_instances .assert_not_called ()
@@ -371,7 +371,7 @@ async def test_cluster_scaling_with_disabled_ssm_does_not_block_autoscaling(
371371 dask_spec_local_cluster : distributed .SpecCluster ,
372372):
373373 await auto_scale_cluster (
374- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
374+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
375375 )
376376 mock_launch_instances .assert_not_called ()
377377 mock_terminate_instances .assert_not_called ()
@@ -412,7 +412,7 @@ async def test_cluster_scaling_with_task_with_too_much_resources_starts_nothing(
412412 assert dask_future
413413
414414 await auto_scale_cluster (
415- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
415+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
416416 )
417417 mock_launch_instances .assert_not_called ()
418418 mock_terminate_instances .assert_not_called ()
@@ -504,7 +504,7 @@ async def test_cluster_scaling_up_and_down( # noqa: PLR0915
504504 assert dask_futures
505505 # this should trigger a scaling up as we have no nodes
506506 await auto_scale_cluster (
507- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
507+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
508508 )
509509
510510 # check the instance was started and we have exactly 1
@@ -538,7 +538,7 @@ async def test_cluster_scaling_up_and_down( # noqa: PLR0915
538538
539539 # 2. running this again should not scale again, but tag the node and make it available
540540 await auto_scale_cluster (
541- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
541+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
542542 )
543543 mock_dask_get_worker_has_results_in_memory .assert_called_once ()
544544 mock_dask_get_worker_has_results_in_memory .reset_mock ()
@@ -636,7 +636,7 @@ async def test_cluster_scaling_up_and_down( # noqa: PLR0915
636636 assert fake_attached_node .description
637637 fake_attached_node .description .hostname = internal_dns_name
638638
639- auto_scaling_mode = ComputationalAutoscaling ()
639+ auto_scaling_mode = ComputationalAutoscalingProvider ()
640640 mocker .patch .object (
641641 auto_scaling_mode ,
642642 "get_monitored_nodes" ,
@@ -880,7 +880,7 @@ async def test_cluster_does_not_scale_up_if_defined_instance_is_not_allowed(
880880
881881 # this should trigger a scaling up as we have no nodes
882882 await auto_scale_cluster (
883- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
883+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
884884 )
885885
886886 # nothing runs
@@ -931,7 +931,7 @@ async def test_cluster_does_not_scale_up_if_defined_instance_is_not_fitting_reso
931931
932932 # this should trigger a scaling up as we have no nodes
933933 await auto_scale_cluster (
934- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
934+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
935935 )
936936
937937 # nothing runs
@@ -998,7 +998,7 @@ async def test_cluster_scaling_up_starts_multiple_instances(
998998
999999 # run the code
10001000 await auto_scale_cluster (
1001- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1001+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
10021002 )
10031003
10041004 # check the instances were started
@@ -1090,7 +1090,7 @@ async def test_cluster_scaling_up_more_than_allowed_max_starts_max_instances_and
10901090
10911091 # this should trigger a scaling up as we have no nodes
10921092 await auto_scale_cluster (
1093- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1093+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
10941094 )
10951095 await assert_autoscaled_computational_ec2_instances (
10961096 ec2_client ,
@@ -1122,7 +1122,7 @@ async def test_cluster_scaling_up_more_than_allowed_max_starts_max_instances_and
11221122 num_useless_calls = 10
11231123 for _ in range (num_useless_calls ):
11241124 await auto_scale_cluster (
1125- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1125+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
11261126 )
11271127 await assert_autoscaled_computational_ec2_instances (
11281128 ec2_client ,
@@ -1191,7 +1191,7 @@ async def test_cluster_scaling_up_more_than_allowed_with_multiple_types_max_star
11911191
11921192 # this should trigger a scaling up as we have no nodes
11931193 await auto_scale_cluster (
1194- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1194+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
11951195 )
11961196
11971197 # one of each type is created with some that will have 2 instances
@@ -1235,7 +1235,7 @@ async def test_cluster_scaling_up_more_than_allowed_with_multiple_types_max_star
12351235 num_useless_calls = 10
12361236 for _ in range (num_useless_calls ):
12371237 await auto_scale_cluster (
1238- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1238+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
12391239 )
12401240 all_instances = await ec2_client .describe_instances ()
12411241 assert len (all_instances ["Reservations" ]) == len (
@@ -1301,7 +1301,7 @@ async def test_long_pending_ec2_is_detected_as_broken_terminated_and_restarted(
13011301
13021302 # this should trigger a scaling up as we have no nodes
13031303 await auto_scale_cluster (
1304- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1304+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
13051305 )
13061306
13071307 # check the instance was started and we have exactly 1
@@ -1345,7 +1345,7 @@ async def test_long_pending_ec2_is_detected_as_broken_terminated_and_restarted(
13451345 # 2. running again several times the autoscaler, the node does not join
13461346 for i in range (7 ):
13471347 await auto_scale_cluster (
1348- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1348+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
13491349 )
13501350 # there should be no scaling up, since there is already a pending instance
13511351 instances = await assert_autoscaled_computational_ec2_instances (
@@ -1389,7 +1389,7 @@ async def test_long_pending_ec2_is_detected_as_broken_terminated_and_restarted(
13891389 )
13901390 # scaling now will terminate the broken ec2 that did not connect, and directly create a replacement
13911391 await auto_scale_cluster (
1392- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1392+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
13931393 )
13941394 # we have therefore 2 reservations, first instance is terminated and a second one started
13951395 all_instances = await ec2_client .describe_instances ()
@@ -1492,7 +1492,7 @@ async def test_cluster_adapts_machines_on_the_fly(
14921492
14931493 # it will only scale once and do nothing else
14941494 await auto_scale_cluster (
1495- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1495+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
14961496 )
14971497 await assert_autoscaled_computational_ec2_instances (
14981498 ec2_client ,
@@ -1519,7 +1519,7 @@ async def test_cluster_adapts_machines_on_the_fly(
15191519 #
15201520 # 2. now the machines are associated
15211521 await auto_scale_cluster (
1522- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1522+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
15231523 )
15241524 analyzed_cluster = assert_cluster_state (
15251525 spied_cluster_analysis ,
@@ -1542,7 +1542,7 @@ async def test_cluster_adapts_machines_on_the_fly(
15421542 # scaling will do nothing since we have hit the maximum number of machines
15431543 for _ in range (3 ):
15441544 await auto_scale_cluster (
1545- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1545+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
15461546 )
15471547 await assert_autoscaled_computational_ec2_instances (
15481548 ec2_client ,
@@ -1576,7 +1576,7 @@ async def test_cluster_adapts_machines_on_the_fly(
15761576 autospec = True ,
15771577 ) as mock_docker_set_node_found_empty :
15781578 await auto_scale_cluster (
1579- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1579+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
15801580 )
15811581 analyzed_cluster = assert_cluster_state (
15821582 spied_cluster_analysis ,
@@ -1601,7 +1601,7 @@ async def test_cluster_adapts_machines_on_the_fly(
16011601 * app_settings .AUTOSCALING_EC2_INSTANCES .EC2_INSTANCES_TIME_BEFORE_DRAINING ,
16021602 ) as mocked_get_node_empty_since :
16031603 await auto_scale_cluster (
1604- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1604+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
16051605 )
16061606 mocked_get_node_empty_since .assert_called_once ()
16071607 analyzed_cluster = assert_cluster_state (
@@ -1617,7 +1617,7 @@ async def test_cluster_adapts_machines_on_the_fly(
16171617 create_fake_node , drained_machine_instance_id , None
16181618 )
16191619 await auto_scale_cluster (
1620- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1620+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
16211621 )
16221622 analyzed_cluster = assert_cluster_state (
16231623 spied_cluster_analysis ,
@@ -1637,7 +1637,7 @@ async def test_cluster_adapts_machines_on_the_fly(
16371637 ):
16381638 mock_docker_tag_node .reset_mock ()
16391639 await auto_scale_cluster (
1640- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1640+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
16411641 )
16421642 analyzed_cluster = assert_cluster_state (
16431643 spied_cluster_analysis ,
@@ -1656,7 +1656,7 @@ async def test_cluster_adapts_machines_on_the_fly(
16561656 create_fake_node , drained_machine_instance_id , drained_machine_instance_id
16571657 )
16581658 await auto_scale_cluster (
1659- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1659+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
16601660 )
16611661 analyzed_cluster = assert_cluster_state (
16621662 spied_cluster_analysis ,
@@ -1681,7 +1681,7 @@ async def test_cluster_adapts_machines_on_the_fly(
16811681 autospec = True ,
16821682 )
16831683 await auto_scale_cluster (
1684- app = initialized_app , auto_scaling_mode = ComputationalAutoscaling ()
1684+ app = initialized_app , auto_scaling_mode = ComputationalAutoscalingProvider ()
16851685 )
16861686 mocked_docker_remove_node .assert_called_once ()
16871687
0 commit comments