Skip to content

Commit 734c5f5

Browse files
authored
Merge branch 'master' into enh/new-batch-get-services
2 parents c106b0e + 6835b03 commit 734c5f5

File tree

43 files changed

+616
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+616
-303
lines changed

api/specs/web-server/_catalog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from models_library.generics import Envelope
1616
from models_library.rest_pagination import Page
1717
from simcore_service_webserver._meta import API_VTAG
18-
from simcore_service_webserver.catalog._handlers import (
18+
from simcore_service_webserver.catalog._rest_controller import (
1919
ListServiceParams,
2020
ServicePathParams,
2121
_FromServiceOutputParams,

api/specs/web-server/_catalog_tags.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from models_library.api_schemas_webserver.catalog import CatalogServiceGet
1111
from models_library.generics import Envelope
1212
from simcore_service_webserver._meta import API_VTAG
13-
from simcore_service_webserver.catalog._tags_handlers import (
13+
from simcore_service_webserver.catalog._rest_tags_controller import (
1414
ServicePathParams,
1515
ServiceTagPathParams,
1616
)
@@ -31,8 +31,7 @@
3131
)
3232
def list_service_tags(
3333
_path_params: Annotated[ServicePathParams, Depends()],
34-
):
35-
...
34+
): ...
3635

3736

3837
@router.post(
@@ -41,8 +40,7 @@ def list_service_tags(
4140
)
4241
def add_service_tag(
4342
_path_params: Annotated[ServiceTagPathParams, Depends()],
44-
):
45-
...
43+
): ...
4644

4745

4846
@router.post(
@@ -51,5 +49,4 @@ def add_service_tag(
5149
)
5250
def remove_service_tag(
5351
_path_params: Annotated[ServiceTagPathParams, Depends()],
54-
):
55-
...
52+
): ...

services/api-server/tests/unit/pact_broker/pacts/05_licensed_items.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
"version": "1.0.0"
128128
}
129129
],
130-
"limit": 50,
130+
"limit": 20,
131131
"links": {
132132
"first": "/v0/licensed-items?offset=0",
133133
"last": "/v0/licensed-items?offset=0",

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/docker_logs.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""
2-
BackgroundLogFetcher:
3-
Creates background task that
4-
reads every line of a container's log and
5-
posts it as a message to rabbit's log channel (logger)
2+
BackgroundLogFetcher:
3+
Creates background task that
4+
reads every line of a container's log and
5+
posts it as a message to rabbit's log channel (logger)
66
"""
77

8-
98
import logging
109
from asyncio import CancelledError, Task, create_task
10+
from collections.abc import AsyncGenerator, Callable, Coroutine
1111
from contextlib import suppress
12-
from typing import Any, AsyncGenerator, Callable, Coroutine, cast
12+
from typing import Any, cast
1313

1414
from aiodocker import DockerError
1515
from fastapi import FastAPI
@@ -85,7 +85,9 @@ async def stop_log_fetching(self, container_name: str) -> None:
8585
return
8686

8787
task.cancel()
88-
with suppress(CancelledError):
88+
89+
# NOTE: sometime the docker engine causes a TimeoutError after the task is cancelled
90+
with suppress(CancelledError, TimeoutError):
8991
await task
9092

9193
logger.debug("Logs fetching stopped for container '%s'", container_name)

services/static-webserver/client/source/class/osparc/store/Data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ qx.Class.define("osparc.store.Data", {
7777
if (locationId in cache && cache[locationId] && cache[locationId].length) {
7878
const data = {
7979
location: locationId,
80-
datasets: cache[locationId]
80+
items: cache[locationId]
8181
};
8282
return data;
8383
}

services/storage/src/simcore_service_storage/api/rest/_files.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import logging
33
from typing import Annotated, cast
4+
from urllib.parse import quote
45

56
from fastapi import APIRouter, Depends, Header, HTTPException, Request
67
from models_library.api_schemas_storage.storage_schemas import (
@@ -202,23 +203,31 @@ async def upload_file(
202203
abort_url = (
203204
URL(f"{request.url}")
204205
.with_path(
205-
request.app.url_path_for(
206-
"abort_upload_file",
207-
location_id=f"{location_id}",
208-
file_id=file_id,
209-
)
206+
quote(
207+
request.app.url_path_for(
208+
"abort_upload_file",
209+
location_id=f"{location_id}",
210+
file_id=file_id,
211+
),
212+
safe=":/",
213+
),
214+
encoded=True,
210215
)
211216
.with_query(user_id=query_params.user_id)
212217
)
213218

214219
complete_url = (
215220
URL(f"{request.url}")
216221
.with_path(
217-
request.app.url_path_for(
218-
"complete_upload_file",
219-
location_id=f"{location_id}",
220-
file_id=file_id,
221-
)
222+
quote(
223+
request.app.url_path_for(
224+
"complete_upload_file",
225+
location_id=f"{location_id}",
226+
file_id=file_id,
227+
),
228+
safe=":/",
229+
),
230+
encoded=True,
222231
)
223232
.with_query(user_id=query_params.user_id)
224233
)
@@ -273,12 +282,16 @@ async def complete_upload_file(
273282
route = (
274283
URL(f"{request.url}")
275284
.with_path(
276-
request.app.url_path_for(
277-
"is_completed_upload_file",
278-
location_id=f"{location_id}",
279-
file_id=file_id,
280-
future_id=task.get_name(),
281-
)
285+
quote(
286+
request.app.url_path_for(
287+
"is_completed_upload_file",
288+
location_id=f"{location_id}",
289+
file_id=file_id,
290+
future_id=task.get_name(),
291+
),
292+
safe=":/",
293+
),
294+
encoded=True,
282295
)
283296
.with_query(user_id=query_params.user_id)
284297
)

services/web/server/src/simcore_service_webserver/catalog/client.py renamed to services/web/server/src/simcore_service_webserver/catalog/_catalog_rest_client_service.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
""" Requests to catalog service API
1+
"""Requests to catalog service API"""
22

3-
"""
4-
import asyncio
53
import logging
64
import urllib.parse
75
from collections.abc import Iterator
@@ -47,7 +45,7 @@ def _handle_client_exceptions(app: web.Application) -> Iterator[ClientSession]:
4745
reason=MSG_CATALOG_SERVICE_UNAVAILABLE
4846
) from err
4947

50-
except (asyncio.TimeoutError, ClientConnectionError) as err:
48+
except (TimeoutError, ClientConnectionError) as err:
5149
_logger.debug("Request to catalog service failed: %s", err)
5250
raise web.HTTPServiceUnavailable(
5351
reason=MSG_CATALOG_SERVICE_UNAVAILABLE

services/web/server/src/simcore_service_webserver/catalog/exceptions.py renamed to services/web/server/src/simcore_service_webserver/catalog/_exceptions.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
"""Defines the different exceptions that may arise in the catalog subpackage"""
22

3+
from servicelib.aiohttp import status
34
from servicelib.rabbitmq.rpc_interfaces.catalog.errors import (
45
CatalogForbiddenError,
56
CatalogItemNotFoundError,
67
)
78

89
from ..errors import WebServerBaseError
10+
from ..exception_handling import (
11+
ExceptionToHttpErrorMap,
12+
HttpErrorInfo,
13+
exception_handling_decorator,
14+
to_exceptions_handlers_map,
15+
)
16+
from ..resource_usage.errors import DefaultPricingPlanNotFoundError
917

1018

1119
class BaseCatalogError(WebServerBaseError):
@@ -35,6 +43,28 @@ def __init__(self, *, service_key: str, service_version: str, **ctxs):
3543
assert CatalogItemNotFoundError # nosec
3644

3745

46+
_TO_HTTP_ERROR_MAP: ExceptionToHttpErrorMap = {
47+
CatalogItemNotFoundError: HttpErrorInfo(
48+
status.HTTP_404_NOT_FOUND,
49+
"Catalog item not found",
50+
),
51+
DefaultPricingPlanNotFoundError: HttpErrorInfo(
52+
status.HTTP_404_NOT_FOUND,
53+
"Default pricing plan not found",
54+
),
55+
DefaultPricingUnitForServiceNotFoundError: HttpErrorInfo(
56+
status.HTTP_404_NOT_FOUND, "Default pricing unit not found"
57+
),
58+
CatalogForbiddenError: HttpErrorInfo(
59+
status.HTTP_403_FORBIDDEN, "Forbidden catalog access"
60+
),
61+
}
62+
63+
handle_plugin_requests_exceptions = exception_handling_decorator(
64+
to_exceptions_handlers_map(_TO_HTTP_ERROR_MAP)
65+
)
66+
67+
3868
__all__: tuple[str, ...] = (
3969
"CatalogForbiddenError",
4070
"CatalogItemNotFoundError",

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

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)