From 24218c1f2aa42b4ee4664ce6af552b607967435a Mon Sep 17 00:00:00 2001 From: Sylvain <35365065+sanderegg@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:34:22 +0100 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Pydantic=20V2:=20after=20u?= =?UTF-8?q?pstream=20merge=20->=20fixes=20(#6651)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent/src/simcore_service_agent/core/settings.py | 4 +++- .../src/simcore_service_api_server/core/settings.py | 4 +++- .../src/simcore_service_autoscaling/core/settings.py | 4 +++- .../src/simcore_service_catalog/core/settings.py | 4 +++- .../simcore_service_clusters_keeper/core/settings.py | 4 +++- .../src/simcore_service_dask_sidecar/settings.py | 2 +- .../simcore_service_datcore_adapter/core/settings.py | 4 +++- .../src/simcore_service_director_v2/core/settings.py | 12 +++++++----- .../core/settings.py | 4 +++- .../simcore_service_dynamic_sidecar/core/settings.py | 4 +++- .../simcore_service_efs_guardian/core/settings.py | 4 +++- .../src/simcore_service_invitations/core/settings.py | 4 +++- .../src/simcore_service_payments/core/settings.py | 4 +++- .../core/settings.py | 4 +++- .../storage/src/simcore_service_storage/settings.py | 4 +++- .../application_settings.py | 4 +++- 16 files changed, 50 insertions(+), 20 deletions(-) diff --git a/services/agent/src/simcore_service_agent/core/settings.py b/services/agent/src/simcore_service_agent/core/settings.py index bb7e8765188..53cdb199f5e 100644 --- a/services/agent/src/simcore_service_agent/core/settings.py +++ b/services/agent/src/simcore_service_agent/core/settings.py @@ -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( diff --git a/services/api-server/src/simcore_service_api_server/core/settings.py b/services/api-server/src/simcore_service_api_server/core/settings.py index d452b82c5e9..b492ec79eff 100644 --- a/services/api-server/src/simcore_service_api_server/core/settings.py +++ b/services/api-server/src/simcore_service_api_server/core/settings.py @@ -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.", ) diff --git a/services/autoscaling/src/simcore_service_autoscaling/core/settings.py b/services/autoscaling/src/simcore_service_autoscaling/core/settings.py index cca295a0c91..51e7a06e7d5 100644 --- a/services/autoscaling/src/simcore_service_autoscaling/core/settings.py +++ b/services/autoscaling/src/simcore_service_autoscaling/core/settings.py @@ -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.", ) diff --git a/services/catalog/src/simcore_service_catalog/core/settings.py b/services/catalog/src/simcore_service_catalog/core/settings.py index 4aad3157427..da8a71fca36 100644 --- a/services/catalog/src/simcore_service_catalog/core/settings.py +++ b/services/catalog/src/simcore_service_catalog/core/settings.py @@ -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( diff --git a/services/clusters-keeper/src/simcore_service_clusters_keeper/core/settings.py b/services/clusters-keeper/src/simcore_service_clusters_keeper/core/settings.py index b7bf1de9245..6595827ea6b 100644 --- a/services/clusters-keeper/src/simcore_service_clusters_keeper/core/settings.py +++ b/services/clusters-keeper/src/simcore_service_clusters_keeper/core/settings.py @@ -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.", ) diff --git a/services/dask-sidecar/src/simcore_service_dask_sidecar/settings.py b/services/dask-sidecar/src/simcore_service_dask_sidecar/settings.py index aae311e54c7..75ac1fb6cb8 100644 --- a/services/dask-sidecar/src/simcore_service_dask_sidecar/settings.py +++ b/services/dask-sidecar/src/simcore_service_dask_sidecar/settings.py @@ -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.", ) diff --git a/services/datcore-adapter/src/simcore_service_datcore_adapter/core/settings.py b/services/datcore-adapter/src/simcore_service_datcore_adapter/core/settings.py index 4bf1cd5a3a1..e2b2bc8791b 100644 --- a/services/datcore-adapter/src/simcore_service_datcore_adapter/core/settings.py +++ b/services/datcore-adapter/src/simcore_service_datcore_adapter/core/settings.py @@ -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 diff --git a/services/director-v2/src/simcore_service_director_v2/core/settings.py b/services/director-v2/src/simcore_service_director_v2/core/settings.py index 9bd5201055b..717694f7f25 100644 --- a/services/director-v2/src/simcore_service_director_v2/core/settings.py +++ b/services/director-v2/src/simcore_service_director_v2/core/settings.py @@ -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 @@ -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 diff --git a/services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/settings.py b/services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/settings.py index ea475e0aec0..d1471052a9f 100644 --- a/services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/settings.py +++ b/services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/settings.py @@ -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.", ) diff --git a/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/settings.py b/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/settings.py index b45ea1118fa..e78abbfeba4 100644 --- a/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/settings.py +++ b/services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/settings.py @@ -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 diff --git a/services/efs-guardian/src/simcore_service_efs_guardian/core/settings.py b/services/efs-guardian/src/simcore_service_efs_guardian/core/settings.py index bd2e711d6ac..39e0b0aa813 100644 --- a/services/efs-guardian/src/simcore_service_efs_guardian/core/settings.py +++ b/services/efs-guardian/src/simcore_service_efs_guardian/core/settings.py @@ -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.", ) diff --git a/services/invitations/src/simcore_service_invitations/core/settings.py b/services/invitations/src/simcore_service_invitations/core/settings.py index 20b04cd830e..6d9b1ec3a25 100644 --- a/services/invitations/src/simcore_service_invitations/core/settings.py +++ b/services/invitations/src/simcore_service_invitations/core/settings.py @@ -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.", ) diff --git a/services/payments/src/simcore_service_payments/core/settings.py b/services/payments/src/simcore_service_payments/core/settings.py index f6af9d6a8fc..7d33beff83f 100644 --- a/services/payments/src/simcore_service_payments/core/settings.py +++ b/services/payments/src/simcore_service_payments/core/settings.py @@ -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.", ) diff --git a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/core/settings.py b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/core/settings.py index d321f733c3c..3a534b692dc 100644 --- a/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/core/settings.py +++ b/services/resource-usage-tracker/src/simcore_service_resource_usage_tracker/core/settings.py @@ -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.", ) diff --git a/services/storage/src/simcore_service_storage/settings.py b/services/storage/src/simcore_service_storage/settings.py index 80ea8634cfb..1931bdb79c2 100644 --- a/services/storage/src/simcore_service_storage/settings.py +++ b/services/storage/src/simcore_service_storage/settings.py @@ -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.", ) diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index 9fa0ac5de7c..a105dcdcc1a 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -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!?