Skip to content

Commit f48cf2c

Browse files
committed
linter
1 parent 666ca05 commit f48cf2c

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

services/autoscaling/src/simcore_service_autoscaling/modules/cluster_scaling/_provider_computational.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,25 @@ def _scheduler_auth(app: FastAPI) -> ClusterAuthentication:
4343

4444
class ComputationalAutoscalingProvider:
4545
async def get_monitored_nodes(self, app: FastAPI) -> list[Node]:
46+
assert self # nosec
4647
return await utils_docker.get_worker_nodes(get_docker_client(app))
4748

4849
def get_ec2_tags(self, app: FastAPI) -> EC2Tags:
50+
assert self # nosec
4951
app_settings = get_application_settings(app)
5052
return utils_ec2.get_ec2_tags_computational(app_settings)
5153

5254
def get_new_node_docker_tags(
5355
self, app: FastAPI, ec2_instance_data: EC2InstanceData
5456
) -> dict[DockerLabelKey, str]:
57+
assert self # nosec
5558
assert app # nosec
5659
return {
5760
DOCKER_TASK_EC2_INSTANCE_TYPE_PLACEMENT_CONSTRAINT_KEY: ec2_instance_data.type
5861
}
5962

6063
async def list_unrunnable_tasks(self, app: FastAPI) -> list[DaskTask]:
64+
assert self # nosec
6165
try:
6266
unrunnable_tasks = await dask.list_unrunnable_tasks(
6367
_scheduler_url(app), _scheduler_auth(app)
@@ -83,17 +87,20 @@ async def list_unrunnable_tasks(self, app: FastAPI) -> list[DaskTask]:
8387
return []
8488

8589
def get_task_required_resources(self, task) -> Resources:
90+
assert self # nosec
8691
return utils.resources_from_dask_task(task)
8792

8893
async def get_task_defined_instance(
8994
self, app: FastAPI, task
9095
) -> InstanceTypeType | None:
96+
assert self # nosec
9197
assert app # nosec
9298
return cast(InstanceTypeType | None, utils.get_task_instance_restriction(task))
9399

94100
async def compute_node_used_resources(
95101
self, app: FastAPI, instance: AssociatedInstance
96102
) -> Resources:
103+
assert self # nosec
97104
try:
98105
resource = await dask.get_worker_used_resources(
99106
_scheduler_url(app), _scheduler_auth(app), instance.ec2_instance
@@ -124,6 +131,7 @@ async def compute_node_used_resources(
124131
async def compute_cluster_used_resources(
125132
self, app: FastAPI, instances: list[AssociatedInstance]
126133
) -> Resources:
134+
assert self # nosec
127135
list_of_used_resources: list[Resources] = await logged_gather(
128136
*(self.compute_node_used_resources(app, i) for i in instances)
129137
)
@@ -135,6 +143,7 @@ async def compute_cluster_used_resources(
135143
async def compute_cluster_total_resources(
136144
self, app: FastAPI, instances: list[AssociatedInstance]
137145
) -> Resources:
146+
assert self # nosec
138147
try:
139148
return await dask.compute_cluster_total_resources(
140149
_scheduler_url(app), _scheduler_auth(app), instances
@@ -145,6 +154,7 @@ async def compute_cluster_total_resources(
145154
async def is_instance_active(
146155
self, app: FastAPI, instance: AssociatedInstance
147156
) -> bool:
157+
assert self # nosec
148158
if not utils_docker.is_node_osparc_ready(instance.node):
149159
return False
150160

@@ -156,11 +166,13 @@ async def is_instance_active(
156166
async def is_instance_retired(
157167
self, app: FastAPI, instance: AssociatedInstance
158168
) -> bool:
169+
assert self # nosec
159170
if not utils_docker.is_node_osparc_ready(instance.node):
160171
return False
161172
return await dask.is_worker_retired(
162173
_scheduler_url(app), _scheduler_auth(app), instance.ec2_instance
163174
)
164175

165176
async def try_retire_nodes(self, app: FastAPI) -> None:
177+
assert self # nosec
166178
await dask.try_retire_nodes(_scheduler_url(app), _scheduler_auth(app))

services/autoscaling/src/simcore_service_autoscaling/modules/cluster_scaling/_provider_dynamic.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
class DynamicAutoscalingProvider:
1414
async def get_monitored_nodes(self, app: FastAPI) -> list[Node]:
15+
assert self # nosec
1516
app_settings = get_application_settings(app)
1617
assert app_settings.AUTOSCALING_NODES_MONITORING # nosec
1718
return await utils_docker.get_monitored_nodes(
@@ -20,16 +21,19 @@ async def get_monitored_nodes(self, app: FastAPI) -> list[Node]:
2021
)
2122

2223
def get_ec2_tags(self, app: FastAPI) -> EC2Tags:
24+
assert self # nosec
2325
app_settings = get_application_settings(app)
2426
return utils_ec2.get_ec2_tags_dynamic(app_settings)
2527

2628
def get_new_node_docker_tags(
2729
self, app: FastAPI, ec2_instance_data: EC2InstanceData
2830
) -> dict[DockerLabelKey, str]:
31+
assert self # nosec
2932
app_settings = get_application_settings(app)
3033
return utils_docker.get_new_node_docker_tags(app_settings, ec2_instance_data)
3134

3235
async def list_unrunnable_tasks(self, app: FastAPI) -> list[Task]:
36+
assert self # nosec
3337
app_settings = get_application_settings(app)
3438
assert app_settings.AUTOSCALING_NODES_MONITORING # nosec
3539
return await utils_docker.pending_service_tasks_with_insufficient_resources(
@@ -38,18 +42,21 @@ async def list_unrunnable_tasks(self, app: FastAPI) -> list[Task]:
3842
)
3943

4044
def get_task_required_resources(self, task) -> Resources:
45+
assert self # nosec
4146
return utils_docker.get_max_resources_from_docker_task(task)
4247

4348
async def get_task_defined_instance(
4449
self, app: FastAPI, task
4550
) -> InstanceTypeType | None:
51+
assert self # nosec
4652
return await utils_docker.get_task_instance_restriction(
4753
get_docker_client(app), task
4854
)
4955

5056
async def compute_node_used_resources(
5157
self, app: FastAPI, instance: AssociatedInstance
5258
) -> Resources:
59+
assert self # nosec
5360
docker_client = get_docker_client(app)
5461
app_settings = get_application_settings(app)
5562
assert app_settings.AUTOSCALING_NODES_MONITORING # nosec
@@ -62,6 +69,7 @@ async def compute_node_used_resources(
6269
async def compute_cluster_used_resources(
6370
self, app: FastAPI, instances: list[AssociatedInstance]
6471
) -> Resources:
72+
assert self # nosec
6573
docker_client = get_docker_client(app)
6674
return await utils_docker.compute_cluster_used_resources(
6775
docker_client, [i.node for i in instances]
@@ -70,6 +78,7 @@ async def compute_cluster_used_resources(
7078
async def compute_cluster_total_resources(
7179
self, app: FastAPI, instances: list[AssociatedInstance]
7280
) -> Resources:
81+
assert self # nosec
7382
assert app # nosec
7483
return await utils_docker.compute_cluster_total_resources(
7584
[i.node for i in instances]
@@ -78,17 +87,20 @@ async def compute_cluster_total_resources(
7887
async def is_instance_active(
7988
self, app: FastAPI, instance: AssociatedInstance
8089
) -> bool:
90+
assert self # nosec
8191
assert app # nosec
8292
return utils_docker.is_node_osparc_ready(instance.node)
8393

8494
async def is_instance_retired(
8595
self, app: FastAPI, instance: AssociatedInstance
8696
) -> bool:
97+
assert self # nosec
8798
assert app # nosec
8899
assert instance # nosec
89100
# nothing to do here
90101
return False
91102

92103
async def try_retire_nodes(self, app: FastAPI) -> None:
104+
assert self # nosec
93105
assert app # nosec
94106
# nothing to do here

0 commit comments

Comments
 (0)