Skip to content

Commit 65fba89

Browse files
committed
simplify
1 parent 2023c10 commit 65fba89

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
_DEFAULT_MAX_CPU: Final[float] = 1
1616
_DEFAULT_MAX_RAM: Final[int] = 1024
1717

18-
_DASK_TO_RESOURCE_NAME_MAPPING: Final[dict[str, str]] = {
18+
DASK_TO_RESOURCE_NAME_MAPPING: Final[dict[str, str]] = {
1919
"CPU": "cpus",
2020
"RAM": "ram",
2121
}
@@ -30,7 +30,7 @@ def resources_from_dask_task(task: DaskTask) -> Resources:
3030
) # merge with defaults to ensure there is always some minimal resource defined
3131

3232
return Resources.from_flat_dict(
33-
task_resources.items(), mapping=_DASK_TO_RESOURCE_NAME_MAPPING
33+
task_resources.items(), mapping=DASK_TO_RESOURCE_NAME_MAPPING
3434
)
3535

3636

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
node_ip_from_ec2_private_dns,
3030
)
3131
from .cluster_scaling._utils_computational import (
32-
resources_from_dask_task,
32+
DASK_TO_RESOURCE_NAME_MAPPING,
3333
)
3434

3535
_logger = logging.getLogger(__name__)
@@ -293,7 +293,9 @@ async def get_worker_used_resources(
293293
total_resources_used.update(task_resources)
294294

295295
_logger.debug("found %s for %s", f"{total_resources_used=}", f"{worker_url=}")
296-
return resources_from_dask_task(total_resources_used)
296+
return Resources.from_flat_dict(
297+
dict(total_resources_used), mapping=DASK_TO_RESOURCE_NAME_MAPPING
298+
)
297299

298300

299301
async def compute_cluster_total_resources(

0 commit comments

Comments
 (0)