Skip to content

Commit

Permalink
⬆️ Pydantic V2: after upstream merge -> fixes (ITISFoundation#6651)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored Nov 1, 2024
1 parent 1fe311d commit 24218c1
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 20 deletions.
4 changes: 3 additions & 1 deletion services/agent/src/simcore_service_agent/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
)
AGENT_VOLUMES_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["AGENT_VOLUMES_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"AGENT_VOLUMES_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)
AGENT_VOLUMES_CLEANUP_TARGET_SWARM_STACK_NAME: str = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class BasicSettings(BaseCustomSettings, MixinLoggingSettings):
)
API_SERVER_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["API_SERVER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"API_SERVER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
)
AUTOSCALING_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["AUTOSCALING_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"AUTOSCALING_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
)
CATALOG_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["CATALOG_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"CATALOG_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)
CATALOG_DEV_FEATURES_ENABLED: bool = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
LoggerName, list[MessageSubstring]
] = Field(
default_factory=dict,
env=["CLUSTERS_KEEPER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"CLUSTERS_KEEPER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Settings(BaseCustomSettings, MixinLoggingSettings):
)
DASK_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["DASK_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices("DASK_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
LoggerName, list[MessageSubstring]
] = Field(
default_factory=dict,
env=["DATCORE_ADAPTER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"DATCORE_ADAPTER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)
DATCORE_ADAPTER_PROMETHEUS_INSTRUMENTATION_ENABLED: bool = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ClusterTypeInModel,
NoAuthentication,
)
from pydantic import AnyHttpUrl, AnyUrl, Field, NonNegativeInt, validator
from pydantic import AliasChoices, AnyHttpUrl, AnyUrl, Field, NonNegativeInt, validator
from servicelib.logging_utils_filtering import LoggerName, MessageSubstring
from settings_library.base import BaseCustomSettings
from settings_library.catalog import CatalogSettings
Expand Down Expand Up @@ -123,19 +123,21 @@ class AppSettings(BaseCustomSettings, MixinLoggingSettings):

LOG_LEVEL: LogLevel = Field(
LogLevel.INFO.value,
env=["DIRECTOR_V2_LOGLEVEL", "LOG_LEVEL", "LOGLEVEL"],
validation_alias=AliasChoices("DIRECTOR_V2_LOGLEVEL", "LOG_LEVEL", "LOGLEVEL"),
)
DIRECTOR_V2_LOG_FORMAT_LOCAL_DEV_ENABLED: bool = Field(
default=False,
env=[
validation_alias=AliasChoices(
"DIRECTOR_V2_LOG_FORMAT_LOCAL_DEV_ENABLED",
"LOG_FORMAT_LOCAL_DEV_ENABLED",
],
),
description="Enables local development log format. WARNING: make sure it is disabled if you want to have structured logs!",
)
DIRECTOR_V2_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["DIRECTOR_V2_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"DIRECTOR_V2_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)
DIRECTOR_V2_DEV_FEATURES_ENABLED: bool = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class _BaseApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
LoggerName, list[MessageSubstring]
] = Field(
default_factory=dict,
env=["DYNAMIC_SCHEDULER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"DYNAMIC_SCHEDULER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
)
DY_SIDECAR_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default={},
env=["DY_SIDECAR_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"DY_SIDECAR_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)
DY_SIDECAR_USER_ID: UserID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
)
EFS_GUARDIAN_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["EFS_GUARDIAN_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"EFS_GUARDIAN_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class _BaseApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
)
INVITATIONS_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["INVITATIONS_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"INVITATIONS_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class _BaseApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
)
PAYMENTS_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["PAYMENTS_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"PAYMENTS_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class _BaseApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
LoggerName, list[MessageSubstring]
] = Field(
default_factory=dict,
env=["RESOURCE_USAGE_TRACKER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"RESOURCE_USAGE_TRACKER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
4 changes: 3 additions & 1 deletion services/storage/src/simcore_service_storage/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ class Settings(BaseCustomSettings, MixinLoggingSettings):
)
STORAGE_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["STORAGE_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"STORAGE_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
)
WEBSERVER_LOG_FILTER_MAPPING: dict[LoggerName, list[MessageSubstring]] = Field(
default_factory=dict,
env=["WEBSERVER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"],
validation_alias=AliasChoices(
"WEBSERVER_LOG_FILTER_MAPPING", "LOG_FILTER_MAPPING"
),
description="is a dictionary that maps specific loggers (such as 'uvicorn.access' or 'gunicorn.access') to a list of log message patterns that should be filtered out.",
)
# TODO: find a better name!?
Expand Down

0 comments on commit 24218c1

Please sign in to comment.