Skip to content

Commit 1ba1f4c

Browse files
Merge branch 'master' into 7795-add-osparc-trace-id-to-response-headers
2 parents 7e60eb8 + cf51daf commit 1ba1f4c

35 files changed

+392
-216
lines changed

.vscode/settings.template.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// This is a template. Clone and replace extension ".template.json" by ".json"
22
{
33
"autoDocstring.docstringFormat": "pep257",
4-
54
"editor.tabSize": 2,
65
"editor.insertSpaces": true,
76
"editor.detectIndentation": false,
@@ -34,6 +33,8 @@
3433
"python.analysis.typeCheckingMode": "basic",
3534
"python.analysis.extraPaths": [
3635
"./packages/aws-library/src",
36+
"./packages/common-library/src",
37+
"./packages/dask-task-models-library/src",
3738
"./packages/models-library/src",
3839
"./packages/postgres-database/src",
3940
"./packages/postgres-database/tests",

packages/models-library/src/models_library/rest_error.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from common_library.basic_types import DEFAULT_FACTORY
55
from models_library.generics import Envelope
66
from pydantic import BaseModel, ConfigDict, Field
7+
from pydantic.config import JsonDict
78

89
from .basic_types import IDStr, LogLevel
910

@@ -72,39 +73,55 @@ class ErrorGet(BaseModel):
7273
description="Message displayed to the user",
7374
),
7475
]
76+
7577
support_id: Annotated[
7678
IDStr | None,
7779
Field(description="ID to track the incident during support", alias="supportId"),
7880
] = None
79-
status: int
8081

81-
# NOTE: The fields blow are DEPRECATED. Still here to keep compatibilty with front-end until updated
82+
status: Annotated[
83+
int,
84+
Field(
85+
description="Redundant HTTP status code of the error."
86+
"Must be the same as in the HTTP response"
87+
),
88+
]
89+
90+
# NOTE: The fields below are DEPRECATED.
91+
# Still here to keep compatibilty with front-end until updated
8292
errors: Annotated[
8393
list[ErrorItemType],
8494
Field(deprecated=True, default_factory=list, json_schema_extra={"default": []}),
8595
] = DEFAULT_FACTORY
96+
8697
logs: Annotated[
8798
list[LogMessageType],
8899
Field(deprecated=True, default_factory=list, json_schema_extra={"default": []}),
89100
] = DEFAULT_FACTORY
90101

102+
@staticmethod
103+
def _update_json_schema_extra(schema: JsonDict) -> None:
104+
schema.update(
105+
{
106+
"examples": [
107+
{
108+
"message": "Sorry you do not have sufficient access rights for product",
109+
"status": 401,
110+
},
111+
{
112+
"message": "Opps this error was unexpected. We are working on that!",
113+
"supportId": "OEC:12346789",
114+
"status": 500,
115+
},
116+
]
117+
}
118+
)
119+
91120
model_config = ConfigDict(
92121
populate_by_name=True,
93122
extra="ignore", # Used to prune extra fields from internal data
94123
frozen=True,
95-
json_schema_extra={
96-
"examples": [
97-
{
98-
"message": "Sorry you do not have sufficient access rights for product",
99-
"status": 401,
100-
},
101-
{
102-
"message": "Opps this error was unexpected. We are working on that!",
103-
"supportId": "OEC:12346789",
104-
"status": 500,
105-
},
106-
]
107-
},
124+
json_schema_extra=_update_json_schema_extra,
108125
)
109126

110127

services/docker-compose.local.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ services:
158158
- "3001:3000"
159159
deploy:
160160
labels:
161-
- traefik.http.services.${SWARM_STACK_NAME}_webserver.loadbalancer.sticky.cookie.secure=false
161+
# locally webserver is accessible through http://
162+
- traefik.http.services.${SWARM_STACK_NAME}_webserver_sticky.loadbalancer.sticky.cookie.secure=false
162163
- traefik.http.routers.${SWARM_STACK_NAME}_webserver_local.service=${SWARM_STACK_NAME}_webserver
163164
- traefik.http.routers.${SWARM_STACK_NAME}_webserver_local.entrypoints=http
164165
- traefik.http.routers.${SWARM_STACK_NAME}_webserver_local.rule=PathPrefix(`/dev/`)

0 commit comments

Comments
 (0)