Skip to content

Commit a26dfb0

Browse files
committed
chore: update service imports for consistency and clarity
1 parent db5eb1f commit a26dfb0

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

services/catalog/src/simcore_service_catalog/service/catalog_services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ async def batch_get_user_services(
703703
704704
Raises:
705705
CatalogItemNotFoundError: When no services are found at all
706+
ValidationError: if the ids are empty
706707
"""
707708
unique_service_identifiers = _BatchIdsValidator.validate_python(ids)
708709

services/web/server/src/simcore_service_webserver/catalog/_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ async def batch_get_my_services(
101101
product_name: ProductName,
102102
services_ids: list[tuple[ServiceKey, ServiceVersion]],
103103
) -> MyServicesBatchGetResult:
104+
assert len(services_ids) > 0 # nosec
104105
try:
105-
106106
return await catalog_rpc.batch_get_my_services(
107107
get_rabbitmq_rpc_client(app),
108108
user_id=user_id,

services/web/server/src/simcore_service_webserver/projects/_controller/nodes_rest.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -546,28 +546,32 @@ async def get_project_services(request: web.Request) -> web.Response:
546546
)
547547
)
548548

549-
batch_got = await catalog_service.batch_get_my_services(
550-
request.app,
551-
product_name=req_ctx.product_name,
552-
user_id=req_ctx.user_id,
553-
services_ids=services_in_project,
554-
)
549+
services = []
550+
missing = None
551+
552+
if services_in_project:
553+
batch_got = await catalog_service.batch_get_my_services(
554+
request.app,
555+
product_name=req_ctx.product_name,
556+
user_id=req_ctx.user_id,
557+
services_ids=services_in_project,
558+
)
559+
services = [
560+
NodeServiceGet.model_validate(sv, from_attributes=True)
561+
for sv in batch_got.found_items
562+
]
563+
missing = (
564+
[
565+
ServiceKeyVersion(key=k, version=v)
566+
for k, v in batch_got.missing_identifiers
567+
]
568+
if batch_got.missing_identifiers
569+
else None
570+
)
555571

556572
return envelope_json_response(
557573
ProjectNodeServicesGet(
558-
project_uuid=path_params.project_id,
559-
services=[
560-
NodeServiceGet.model_validate(sv, from_attributes=True)
561-
for sv in batch_got.found_items
562-
],
563-
missing=(
564-
[
565-
ServiceKeyVersion(key=k, version=v)
566-
for k, v in batch_got.missing_identifiers
567-
]
568-
if batch_got.missing_identifiers
569-
else None
570-
),
574+
project_uuid=path_params.project_id, services=services, missing=missing
571575
)
572576
)
573577

0 commit comments

Comments
 (0)