Skip to content

Commit 8194598

Browse files
committed
use new syntax
1 parent e632c5a commit 8194598

File tree

10 files changed

+395
-384
lines changed

10 files changed

+395
-384
lines changed

services/autoscaling/src/simcore_service_autoscaling/modules/auto_scaling_core.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262

6363

6464
def _node_not_ready(node: Node) -> bool:
65-
assert node.Status # nosec
66-
return bool(node.Status.State != NodeState.ready)
65+
assert node.status # nosec
66+
return bool(node.status.state != NodeState.ready)
6767

6868

6969
async def _analyze_current_cluster(
@@ -892,7 +892,7 @@ async def _find_drainable_nodes(
892892
if drainable_nodes:
893893
_logger.info(
894894
"the following nodes were found to be drainable: '%s'",
895-
f"{[instance.node.Description.Hostname for instance in drainable_nodes if instance.node.Description]}",
895+
f"{[instance.node.description.hostname for instance in drainable_nodes if instance.node.description]}",
896896
)
897897
return drainable_nodes
898898

@@ -920,7 +920,7 @@ async def _deactivate_empty_nodes(app: FastAPI, cluster: Cluster) -> Cluster:
920920
if updated_nodes:
921921
_logger.info(
922922
"following nodes were set to drain: '%s'",
923-
f"{[node.Description.Hostname for node in updated_nodes if node.Description]}",
923+
f"{[node.description.hostname for node in updated_nodes if node.description]}",
924924
)
925925
newly_drained_instances = [
926926
AssociatedInstance(node=node, ec2_instance=instance.ec2_instance)
@@ -970,7 +970,7 @@ async def _find_terminateable_instances(
970970
if terminateable_nodes:
971971
_logger.info(
972972
"the following nodes were found to be terminateable: '%s'",
973-
f"{[instance.node.Description.Hostname for instance in terminateable_nodes if instance.node.Description]}",
973+
f"{[instance.node.description.hostname for instance in terminateable_nodes if instance.node.description]}",
974974
)
975975
return terminateable_nodes
976976

@@ -981,11 +981,11 @@ async def _try_scale_down_cluster(app: FastAPI, cluster: Cluster) -> Cluster:
981981
# instances found to be terminateable will now start the termination process.
982982
new_terminating_instances = []
983983
for instance in await _find_terminateable_instances(app, cluster):
984-
assert instance.node.Description is not None # nosec
984+
assert instance.node.description is not None # nosec
985985
with log_context(
986986
_logger,
987987
logging.INFO,
988-
msg=f"termination process for {instance.node.Description.Hostname}:{instance.ec2_instance.id}",
988+
msg=f"termination process for {instance.node.description.hostname}:{instance.ec2_instance.id}",
989989
), log_catch(_logger, reraise=False):
990990
await utils_docker.set_node_begin_termination_process(
991991
get_docker_client(app), instance.node
@@ -1005,7 +1005,7 @@ async def _try_scale_down_cluster(app: FastAPI, cluster: Cluster) -> Cluster:
10051005
with log_context(
10061006
_logger,
10071007
logging.INFO,
1008-
msg=f"definitely terminate '{[i.node.Description.Hostname for i in instances_to_terminate if i.node.Description]}'",
1008+
msg=f"definitely terminate '{[i.node.description.hostname for i in instances_to_terminate if i.node.description]}'",
10091009
):
10101010
await get_ec2_client(app).terminate_instances(
10111011
[i.ec2_instance for i in instances_to_terminate]
@@ -1109,7 +1109,7 @@ async def _drain_retired_nodes(
11091109
if updated_nodes:
11101110
_logger.info(
11111111
"following nodes were set to drain: '%s'",
1112-
f"{[node.Description.Hostname for node in updated_nodes if node.Description]}",
1112+
f"{[node.description.hostname for node in updated_nodes if node.description]}",
11131113
)
11141114
newly_drained_instances = [
11151115
AssociatedInstance(node=node, ec2_instance=instance.ec2_instance)

services/autoscaling/src/simcore_service_autoscaling/utils/auto_scaling_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ async def associate_ec2_instances_with_nodes(
5656
non_associated_instances: list[EC2InstanceData] = []
5757

5858
def _find_node_with_name(node: Node) -> bool:
59-
assert node.Description # nosec
60-
return bool(node.Description.Hostname == docker_node_name)
59+
assert node.description # nosec
60+
return bool(node.description.hostname == docker_node_name)
6161

6262
for instance_data in ec2_instances:
6363
try:

0 commit comments

Comments
 (0)