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
@@ -754,9 +752,9 @@ async def _() -> None:
754752 assert tasks , f"no tasks available for { found_service ['Spec' ]['Name' ]} "
755753 assert len (tasks ) == 1
756754 service_task = tasks [0 ]
757- assert (
758- service_task [" Status" ][ " State" ] in expected_states
759- ), f"service { found_service [ 'Spec' ][ 'Name' ] } 's task is { service_task [ 'Status' ][ 'State' ] } "
755+ assert service_task [ "Status" ][ "State" ] in expected_states , (
756+ f"service { found_service [ 'Spec' ][ 'Name' ] } 's task is { service_task [' Status' ][ ' State' ] } "
757+ )
760758 ctx .logger .info (
761759 "%s" ,
762760 f"service { found_service ['Spec' ]['Name' ]} is now { service_task ['Status' ]['State' ]} { '.' * number_of_success ['count' ]} " ,
@@ -983,7 +981,9 @@ def _creator(
983981 assert (
984982 datetime .timedelta (seconds = 10 )
985983 < app_settings .AUTOSCALING_EC2_INSTANCES .EC2_INSTANCES_TIME_BEFORE_TERMINATION
986- ), "this tests relies on the fact that the time before termination is above 10 seconds"
984+ ), (
985+ "this tests relies on the fact that the time before termination is above 10 seconds"
986+ )
987987 assert app_settings .AUTOSCALING_EC2_INSTANCES
988988 seconds_delta = (
989989 - datetime .timedelta (seconds = 10 )
@@ -1124,12 +1124,12 @@ def ec2_instances_allowed_types_with_only_1_buffered(
11241124 allowed_ec2_types .items (),
11251125 )
11261126 )
1127- assert (
1128- allowed_ec2_types_with_buffer_defined
1129- ), "one type with buffer is needed for the tests!"
1130- assert (
1131- len ( allowed_ec2_types_with_buffer_defined ) == 1
1132- ), "more than one type with buffer is disallowed in this test!"
1127+ assert allowed_ec2_types_with_buffer_defined , (
1128+ "one type with buffer is needed for the tests!"
1129+ )
1130+ assert len ( allowed_ec2_types_with_buffer_defined ) == 1 , (
1131+ "more than one type with buffer is disallowed in this test!"
1132+ )
11331133 return {
11341134 TypeAdapter (InstanceTypeType ).validate_python (k ): v
11351135 for k , v in allowed_ec2_types_with_buffer_defined .items ()
@@ -1153,9 +1153,9 @@ def _by_buffer_count(
11531153 filter (_by_buffer_count , allowed_ec2_types .items ())
11541154 )
11551155 assert allowed_ec2_types_with_buffer_defined , "you need one type with buffer"
1156- assert (
1157- len ( allowed_ec2_types_with_buffer_defined ) == 1
1158- ), "more than one type with buffer is disallowed in this test!"
1156+ assert len ( allowed_ec2_types_with_buffer_defined ) == 1 , (
1157+ "more than one type with buffer is disallowed in this test!"
1158+ )
11591159 return next (iter (allowed_ec2_types_with_buffer_defined .values ())).buffer_count
11601160
11611161
0 commit comments