4040)
4141from models_library .generated_models .docker_rest_api import (
4242 Availability ,
43- )
44- from models_library .generated_models .docker_rest_api import Node as DockerNode
45- from models_library .generated_models .docker_rest_api import (
4643 NodeDescription ,
4744 NodeSpec ,
4845 NodeState ,
5249 Service ,
5350 TaskSpec ,
5451)
52+ from models_library .generated_models .docker_rest_api import Node as DockerNode
5553from pydantic import ByteSize , NonNegativeInt , PositiveInt , TypeAdapter
5654from pytest_mock import MockType
5755from pytest_mock .plugin import MockerFixture
8482)
8583from simcore_service_autoscaling .modules .docker import AutoscalingDocker
8684from simcore_service_autoscaling .modules .ec2 import SimcoreEC2API
87- from simcore_service_autoscaling .utils .buffer_machines import (
88- get_deactivated_buffer_ec2_tags ,
89- )
9085from simcore_service_autoscaling .utils .utils_docker import (
9186 _OSPARC_SERVICE_READY_LABEL_KEY ,
9287 _OSPARC_SERVICES_READY_DATETIME_LABEL_KEY ,
9388)
89+ from simcore_service_autoscaling .utils .warm_buffer_machines import (
90+ get_deactivated_buffer_ec2_tags ,
91+ )
9492from tenacity import after_log , before_sleep_log , retry
9593from tenacity .retry import retry_if_exception_type
9694from tenacity .stop import stop_after_delay
@@ -755,9 +753,9 @@ async def _() -> None:
755753 assert tasks , f"no tasks available for { found_service ['Spec' ]['Name' ]} "
756754 assert len (tasks ) == 1
757755 service_task = tasks [0 ]
758- assert (
759- service_task [" Status" ][ " State" ] in expected_states
760- ), f"service { found_service [ 'Spec' ][ 'Name' ] } 's task is { service_task [ 'Status' ][ 'State' ] } "
756+ assert service_task [ "Status" ][ "State" ] in expected_states , (
757+ f"service { found_service [ 'Spec' ][ 'Name' ] } 's task is { service_task [' Status' ][ ' State' ] } "
758+ )
761759 ctx .logger .info (
762760 "%s" ,
763761 f"service { found_service ['Spec' ]['Name' ]} is now { service_task ['Status' ]['State' ]} { '.' * number_of_success ['count' ]} " ,
@@ -984,7 +982,9 @@ def _creator(
984982 assert (
985983 datetime .timedelta (seconds = 10 )
986984 < app_settings .AUTOSCALING_EC2_INSTANCES .EC2_INSTANCES_TIME_BEFORE_TERMINATION
987- ), "this tests relies on the fact that the time before termination is above 10 seconds"
985+ ), (
986+ "this tests relies on the fact that the time before termination is above 10 seconds"
987+ )
988988 assert app_settings .AUTOSCALING_EC2_INSTANCES
989989 seconds_delta = (
990990 - datetime .timedelta (seconds = 10 )
@@ -1125,12 +1125,12 @@ def ec2_instances_allowed_types_with_only_1_buffered(
11251125 allowed_ec2_types .items (),
11261126 )
11271127 )
1128- assert (
1129- allowed_ec2_types_with_buffer_defined
1130- ), "one type with buffer is needed for the tests!"
1131- assert (
1132- len ( allowed_ec2_types_with_buffer_defined ) == 1
1133- ), "more than one type with buffer is disallowed in this test!"
1128+ assert allowed_ec2_types_with_buffer_defined , (
1129+ "one type with buffer is needed for the tests!"
1130+ )
1131+ assert len ( allowed_ec2_types_with_buffer_defined ) == 1 , (
1132+ "more than one type with buffer is disallowed in this test!"
1133+ )
11341134 return {
11351135 TypeAdapter (InstanceTypeType ).validate_python (k ): v
11361136 for k , v in allowed_ec2_types_with_buffer_defined .items ()
@@ -1154,9 +1154,9 @@ def _by_buffer_count(
11541154 filter (_by_buffer_count , allowed_ec2_types .items ())
11551155 )
11561156 assert allowed_ec2_types_with_buffer_defined , "you need one type with buffer"
1157- assert (
1158- len ( allowed_ec2_types_with_buffer_defined ) == 1
1159- ), "more than one type with buffer is disallowed in this test!"
1157+ assert len ( allowed_ec2_types_with_buffer_defined ) == 1 , (
1158+ "more than one type with buffer is disallowed in this test!"
1159+ )
11601160 return next (iter (allowed_ec2_types_with_buffer_defined .values ())).buffer_count
11611161
11621162
0 commit comments