Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ def legacy_enforce_str_to_int(cls, v):
return int(v)
return v

model_config = ConfigDict(
populate_by_name=True,
)
model_config = ConfigDict(populate_by_name=True)


class SimCoreFileLink(BaseFileLink):
"""I/O port type to hold a link to a file in simcore S3 storage"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CreateServiceMetricsAdditionalParams(BaseModel):
"wallet_name": "a private wallet for me",
"pricing_plan_id": 1,
"pricing_unit_id": 1,
"pricing_unit_cost_id": 1,
"pricing_unit_detail_id": 1,
"product_name": "osparc",
"simcore_user_agent": "undefined",
Expand Down
17 changes: 10 additions & 7 deletions packages/models-library/src/models_library/services_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from uuid import uuid4

import arrow
from pydantic import StringConstraints
from models_library.basic_types import ConstrainedStr
from pydantic import StringConstraints, TypeAdapter

from .basic_regex import PROPERTY_KEY_RE, SIMPLE_VERSION_RE
from .services_regex import (
Expand All @@ -19,9 +20,13 @@

ServiceKey: TypeAlias = Annotated[str, StringConstraints(pattern=SERVICE_KEY_RE)]

ServiceKeyEncoded: TypeAlias = Annotated[str, StringConstraints(pattern=SERVICE_ENCODED_KEY_RE)]
ServiceKeyEncoded: TypeAlias = Annotated[
str, StringConstraints(pattern=SERVICE_ENCODED_KEY_RE)
]

DynamicServiceKey: TypeAlias = Annotated[str, StringConstraints(pattern=DYNAMIC_SERVICE_KEY_RE)]
DynamicServiceKey: TypeAlias = Annotated[
str, StringConstraints(pattern=DYNAMIC_SERVICE_KEY_RE)
]

ComputationalServiceKey: TypeAlias = Annotated[
str, StringConstraints(pattern=COMPUTATIONAL_SERVICE_KEY_RE)
Expand All @@ -30,7 +35,7 @@
ServiceVersion: TypeAlias = Annotated[str, StringConstraints(pattern=SIMPLE_VERSION_RE)]


class RunID(str):
class RunID(ConstrainedStr):
"""
Used to assign a unique identifier to the run of a service.

Expand All @@ -41,8 +46,6 @@ class RunID(str):
and gives the osparc-agent an opportunity to back it up.
"""

__slots__ = ()

@classmethod
def create(cls) -> "RunID":
# NOTE: there was a legacy version of this RunID
Expand All @@ -52,4 +55,4 @@ def create(cls) -> "RunID":
# '1690203099_0ac3ed64-665b-42d2-95f7-e59e0db34242'
utc_int_timestamp: int = arrow.utcnow().int_timestamp
run_id_format = f"{utc_int_timestamp}_{uuid4()}"
return cls(run_id_format)
return TypeAdapter(cls).validate_python(run_id_format)
2 changes: 1 addition & 1 deletion services/dynamic-sidecar/.env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DY_SIDECAR_USER_SERVICES_HAVE_INTERNET_ACCESS=false
# DOCKER REGISTRY
DY_DEPLOYMENT_REGISTRY_SETTINGS='{"REGISTRY_AUTH":"false","REGISTRY_USER":"test","REGISTRY_PW":"test","REGISTRY_SSL":"false"}'

S3_ENDPOINT=http://145.456.25.54:12345
S3_ENDPOINT=http://111.222.111.222:12345
S3_ACCESS_KEY=mocked
S3_REGION=mocked
S3_SECRET_KEY=mocked
Expand Down
Loading