Skip to content

Commit

Permalink
🐛Bugfix: Cannot instantiate templates (#6198)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored Aug 16, 2024
1 parent 7d44591 commit 6773ddc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@ async def dir_downloaded_files_2(tmp_path: Path, faker: Faker) -> AsyncIterator[
(1, parse_obj_as(ByteSize, "1mib"), False),
(2, parse_obj_as(ByteSize, "1mib"), False),
(1, parse_obj_as(ByteSize, "1Gib"), True),
(4, parse_obj_as(ByteSize, "500Mib"), True),
(100, parse_obj_as(ByteSize, "20mib"), True),
pytest.param(
4, parse_obj_as(ByteSize, "500Mib"), True, marks=pytest.mark.heavy_load
),
pytest.param(
100, parse_obj_as(ByteSize, "20mib"), True, marks=pytest.mark.heavy_load
),
],
)
async def test_local_to_remote_to_local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ async def dir_downloaded_files_2(tmp_path: Path, faker: Faker) -> AsyncIterator[
(1, parse_obj_as(ByteSize, "1mib"), False),
(2, parse_obj_as(ByteSize, "1mib"), False),
(1, parse_obj_as(ByteSize, "1Gib"), True),
(4, parse_obj_as(ByteSize, "500Mib"), True),
(100, parse_obj_as(ByteSize, "20mib"), True),
pytest.param(
4, parse_obj_as(ByteSize, "500Mib"), True, marks=pytest.mark.heavy_load
),
pytest.param(
100, parse_obj_as(ByteSize, "20mib"), True, marks=pytest.mark.heavy_load
),
],
)
async def test_local_to_remote_to_local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from models_library.products import ProductName
from models_library.rest_pagination import PageLimitInt
from models_library.services_access import ServiceGroupAccessRightsV2
from models_library.services_enums import ServiceType
from models_library.services_history import Compatibility, ServiceRelease
from models_library.services_metadata_published import ServiceMetaDataPublished
from models_library.services_types import ServiceKey, ServiceVersion
Expand All @@ -15,39 +14,28 @@
CatalogForbiddenError,
CatalogItemNotFoundError,
)
from simcore_service_catalog.models.services_db import (

from ..db.repositories.services import ServicesRepository
from ..models.services_db import (
ServiceAccessRightsAtDB,
ServiceMetaDataAtDB,
ServiceWithHistoryFromDB,
)
from simcore_service_catalog.services import manifest
from simcore_service_catalog.services.director import DirectorApi

from ..db.repositories.services import ServicesRepository
from ..services import manifest
from ..services.director import DirectorApi
from .compatibility import evaluate_service_compatibility_map
from .function_services import is_function_service

_logger = logging.getLogger(__name__)


def _deduce_service_type_from(key: str) -> ServiceType:
for e in ServiceType:
tag = e.value if e != ServiceType.COMPUTATIONAL else "comp"
if tag in key:
return e
raise ValueError(key)


def _db_to_api_model(
service_db: ServiceWithHistoryFromDB,
access_rights_db: list[ServiceAccessRightsAtDB],
service_manifest: ServiceMetaDataPublished,
compatibility_map: dict[ServiceVersion, Compatibility | None] | None = None,
) -> ServiceGetV2:
compatibility_map = compatibility_map or {}
assert ( # nosec
_deduce_service_type_from(service_db.key) == service_manifest.service_type
)

return ServiceGetV2(
key=service_db.key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ async def get_files_metadata(request: web.Request) -> web.Response:
data: list[FileMetaData] = await dsm.list_files(
user_id=query_params.user_id,
expand_dirs=query_params.expand_dirs,
uuid_filter=query_params.uuid_filter,
uuid_filter=query_params.uuid_filter
or f"{query_params.project_id or ''}", # NOTE: https://github.com/ITISFoundation/osparc-issues/issues/1593
project_id=query_params.project_id,
)
return web.json_response(
Expand Down

0 comments on commit 6773ddc

Please sign in to comment.