From 56210f8caa4c4e62f2aeff0bbf7ac2886261c21e Mon Sep 17 00:00:00 2001 From: Mattia <5013654+mattiamatrix@users.noreply.github.com> Date: Thu, 18 Jan 2024 20:58:22 +0000 Subject: [PATCH] Test different hash --- prefect_aws/client_parameters.py | 12 ++++++++++++ prefect_aws/credentials.py | 20 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/prefect_aws/client_parameters.py b/prefect_aws/client_parameters.py index bf030590..eb3be09b 100644 --- a/prefect_aws/client_parameters.py +++ b/prefect_aws/client_parameters.py @@ -70,6 +70,18 @@ class AwsClientParameters(BaseModel): title="Botocore Config", ) + def __hash__(self): + return hash( + ( + self.api_version, + self.use_ssl, + self.verify, + self.verify_cert_path, + self.endpoint_url, + self.config, + ) + ) + @validator("config", pre=True) def instantiate_config(cls, value: Union[Config, Dict[str, Any]]) -> Dict[str, Any]: """ diff --git a/prefect_aws/credentials.py b/prefect_aws/credentials.py index 5125e56a..0646f1b4 100644 --- a/prefect_aws/credentials.py +++ b/prefect_aws/credentials.py @@ -108,7 +108,16 @@ class Config: arbitrary_types_allowed = True def __hash__(self): - return hash(self.json()) + return hash( + ( + self.aws_access_key_id, + self.aws_secret_access_key, + self.aws_session_token, + self.profile_name, + self.region_name, + self.aws_client_parameters, + ) + ) def get_boto3_session(self) -> boto3.Session: """ @@ -221,7 +230,14 @@ class Config: arbitrary_types_allowed = True def __hash__(self): - return hash(self.json()) + return hash( + ( + self.minio_root_user, + self.minio_root_password, + self.region_name, + self.aws_client_parameters, + ) + ) def get_boto3_session(self) -> boto3.Session: """