-
Notifications
You must be signed in to change notification settings - Fork 32
✨ New CatalogService in api-server that connects via rpc to the catalog micro-service
#7439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pcrespov
merged 23 commits into
ITISFoundation:master
from
pcrespov:is7421/upgrade-catalog-service-listing
Mar 27, 2025
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3e753db
drafts catalog service
pcrespov 240da75
pagination
pcrespov 41844d5
udpates api
pcrespov d514cba
draft catalog tests
pcrespov aeb9c9a
draft implementation
pcrespov f6c7859
draft implementation
pcrespov c72030d
deprecates get operations
pcrespov 9fc678b
services/catalog version: 0.8.0 → 0.8.1
pcrespov 38c1915
sideeffects
pcrespov e6bf689
extending test
pcrespov eec071f
refactor
pcrespov 6a9b289
adding pagination to history
pcrespov f762de7
adapting catalog
pcrespov 927dc9c
draft tests
pcrespov 8cfa6a9
fixes tests
pcrespov 339b344
renaming
pcrespov 397aecd
cleanup
pcrespov d91a670
fixes tests
pcrespov 6e4df24
updates OAS
pcrespov 47add77
fixes mypy
pcrespov 3702e71
fixing queries
pcrespov 1b60257
fixing tests
pcrespov 28039ae
@GitHK review:doc
pcrespov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
packages/pytest-simcore/src/pytest_simcore/helpers/catalog_rpc_server.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # pylint: disable=not-context-manager | ||
| # pylint: disable=protected-access | ||
| # pylint: disable=redefined-outer-name | ||
| # pylint: disable=unused-argument | ||
| # pylint: disable=unused-variable | ||
|
|
||
|
|
||
| from models_library.api_schemas_catalog.services import LatestServiceGet, ServiceGetV2 | ||
| from models_library.api_schemas_webserver.catalog import ( | ||
| CatalogServiceUpdate, | ||
| ) | ||
| from models_library.products import ProductName | ||
| from models_library.rest_pagination import PageOffsetInt | ||
| from models_library.rpc_pagination import PageLimitInt, PageRpc | ||
| from models_library.services_history import ServiceRelease | ||
| from models_library.services_types import ServiceKey, ServiceVersion | ||
| from models_library.users import UserID | ||
| from pydantic import NonNegativeInt, TypeAdapter | ||
| from servicelib.rabbitmq._client_rpc import RabbitMQRPCClient | ||
|
|
||
|
|
||
| class CatalogRpcSideEffects: | ||
pcrespov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # pylint: disable=no-self-use | ||
| async def list_services_paginated( | ||
| self, | ||
| rpc_client: RabbitMQRPCClient, | ||
| *, | ||
| product_name: ProductName, | ||
| user_id: UserID, | ||
| limit: PageLimitInt, | ||
| offset: NonNegativeInt, | ||
| ): | ||
| assert rpc_client | ||
| assert product_name | ||
| assert user_id | ||
|
|
||
| items = TypeAdapter(list[LatestServiceGet]).validate_python( | ||
| LatestServiceGet.model_json_schema()["examples"], | ||
| ) | ||
| total_count = len(items) | ||
|
|
||
| return PageRpc[LatestServiceGet].create( | ||
| items[offset : offset + limit], | ||
| total=total_count, | ||
| limit=limit, | ||
| offset=offset, | ||
| ) | ||
|
|
||
| async def get_service( | ||
| self, | ||
| rpc_client: RabbitMQRPCClient, | ||
| *, | ||
| product_name: ProductName, | ||
| user_id: UserID, | ||
| service_key: ServiceKey, | ||
| service_version: ServiceVersion, | ||
| ): | ||
| assert rpc_client | ||
| assert product_name | ||
| assert user_id | ||
|
|
||
| got = ServiceGetV2.model_validate( | ||
| ServiceGetV2.model_json_schema()["examples"][0] | ||
| ) | ||
| got.version = service_version | ||
| got.key = service_key | ||
|
|
||
| return got | ||
|
|
||
| async def update_service( | ||
| self, | ||
| rpc_client: RabbitMQRPCClient, | ||
| *, | ||
| product_name: ProductName, | ||
| user_id: UserID, | ||
| service_key: ServiceKey, | ||
| service_version: ServiceVersion, | ||
| update: CatalogServiceUpdate, | ||
| ): | ||
| assert rpc_client | ||
| assert product_name | ||
| assert user_id | ||
|
|
||
| got = ServiceGetV2.model_validate( | ||
| ServiceGetV2.model_json_schema()["examples"][0] | ||
| ) | ||
| got.version = service_version | ||
| got.key = service_key | ||
| return got.model_copy(update=update.model_dump(exclude_unset=True)) | ||
|
|
||
| async def list_my_service_history_paginated( | ||
| self, | ||
| rpc_client: RabbitMQRPCClient, | ||
| *, | ||
| product_name: ProductName, | ||
| user_id: UserID, | ||
| service_key: ServiceKey, | ||
| offset: PageOffsetInt, | ||
| limit: PageLimitInt, | ||
| ) -> PageRpc[ServiceRelease]: | ||
|
|
||
| assert rpc_client | ||
| assert product_name | ||
| assert user_id | ||
| assert service_key | ||
|
|
||
| items = TypeAdapter(list[ServiceRelease]).validate_python( | ||
| ServiceRelease.model_json_schema()["examples"], | ||
| ) | ||
| total_count = len(items) | ||
|
|
||
| return PageRpc[ServiceRelease].create( | ||
| items[offset : offset + limit], | ||
| total=total_count, | ||
| limit=limit, | ||
| offset=offset, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.