Anh Pham
03/01/2024, 12:18 PMTypeError: unhashable type: 'dict'
My hunch is problem is raised after one of these PRs:
• #369
• #373
• #375
This is quite a breaking change and prevent me from upgrading to latest version. Can someone take a look into this?Kevin Grismore
03/01/2024, 1:47 PMAnh Pham
03/01/2024, 2:34 PMKevin Grismore
03/01/2024, 5:21 PMprefect-aws
0.4.10Kevin Grismore
03/01/2024, 5:22 PMAnh Pham
03/03/2024, 6:04 PM''dict' object has no attribute 'get_params_override''."
I was using prefect 2.16.0 with prefect-aws 0.4.6 on hosted serverAnh Pham
03/03/2024, 6:04 PMAnh Pham
03/03/2024, 6:06 PMAnh Pham
03/03/2024, 6:07 PMaws_client_parameters
for worker or server.Kevin Grismore
03/03/2024, 6:11 PMaws_client_parameters
field should be of type AwsClientParameters
which has the get_params_override
methodKevin Grismore
03/03/2024, 6:11 PMKevin Grismore
03/03/2024, 6:12 PMS3Bucket
block, right?Anh Pham
03/03/2024, 6:13 PMKevin Grismore
03/03/2024, 6:14 PMAwsCredentials
block nested in it?Anh Pham
03/03/2024, 6:14 PMbucket_name
and bucket_folder
Anh Pham
03/03/2024, 6:14 PMcredentials
Anh Pham
03/03/2024, 6:15 PMKevin Grismore
03/03/2024, 6:17 PMKevin Grismore
03/03/2024, 6:19 PMKevin Grismore
03/03/2024, 6:19 PMKevin Grismore
03/03/2024, 6:22 PM>>> from prefect_aws import S3Bucket
>>> bucket = S3Bucket(bucket_name="my-bucket",bucket_folder="a-folder")
>>> bucket.credentials.aws_client_parameters
AwsClientParameters(api_version=None, use_ssl=True, verify=True, verify_cert_path=None, endpoint_url=None, config=None)
>>> bucket.credentials.aws_client_parameters.get_params_override()
{'use_ssl': True, 'verify': True}
Anh Pham
03/03/2024, 6:36 PMAnh Pham
03/03/2024, 6:45 PMTraceback (most recent call last):
File "***/get_flow_run.py", line 60, in get_flow_run
await flow_run.state.result(fetch=True) # type: ignore[call-overload]
File "***/.venv/lib/python3.10/site-packages/prefect/states.py", line 98, in _get_state_result
result = await state.data.get()
File "***/.venv/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "***/.venv/lib/python3.10/site-packages/prefect/results.py", line 534, in get
blob = await self._read_blob(client=client)
File "***/.venv/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "***/.venv/lib/python3.10/site-packages/prefect/results.py", line 549, in _read_blob
content = await storage_block.read_path(self.storage_key)
File "***/.venv/lib/python3.10/site-packages/prefect_aws/s3.py", line 606, in read_path
return await run_sync_in_worker_thread(self._read_sync, path)
File "***/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "***/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "***/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "***/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "***/.venv/lib/python3.10/site-packages/prefect_aws/s3.py", line 614, in _read_sync
s3_client = self._get_s3_client()
File "***/.venv/lib/python3.10/site-packages/prefect_aws/s3.py", line 469, in _get_s3_client
return self.credentials.get_client("s3")
File "***/.venv/lib/python3.10/site-packages/prefect_aws/credentials.py", line 170, in get_client
return _get_client_cached(ctx=self, client_type=client_type)
File "***/.venv/lib/python3.10/site-packages/prefect_aws/credentials.py", line 121, in __hash__
hash(self.aws_client_parameters),
TypeError: unhashable type: 'dict'
Anh Pham
03/03/2024, 6:56 PMAnh Pham
03/03/2024, 6:59 PMaws_credentials
looks like
AwsCredentials(aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, profile_name=None, region_name=None, aws_client_parameters={'api_version': None, 'use_ssl': True, 'verify': True, 'verify_cert_path': None, 'endpoint_url': None, 'config': None})
Anh Pham
03/03/2024, 6:59 PMaws_client_parameters
looks like
{'api_version': None, 'use_ssl': True, 'verify': True, 'verify_cert_path': None, 'endpoint_url': None, 'config': None}
Anh Pham
03/03/2024, 7:01 PMdict
and can’t be hashed 😕Kevin Grismore
03/03/2024, 7:02 PMKevin Grismore
03/03/2024, 7:02 PMAnh Pham
03/03/2024, 8:14 PMAnh Pham
03/03/2024, 8:15 PMAnh Pham
03/03/2024, 8:20 PMAnh Pham
03/03/2024, 9:27 PMTraceback (most recent call last):
File "***/get_flow_run.py", line 60, in get_flow_run
await flow_run.state.result(fetch=True) # type: ignore[call-overload]
File "***/.venv/lib/python3.10/site-packages/prefect/states.py", line 89, in _get_state_result
result = await state.data.get()
File "***/.venv/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "***/.venv/lib/python3.10/site-packages/prefect/results.py", line 534, in get
blob = await self._read_blob(client=client)
File "***/.venv/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "***/.venv/lib/python3.10/site-packages/prefect/results.py", line 549, in _read_blob
content = await storage_block.read_path(self.storage_key)
File "***/.venv/lib/python3.10/site-packages/prefect_aws/s3.py", line 580, in read_path
return await run_sync_in_worker_thread(self._read_sync, path)
File "***/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "***/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "***/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "***/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "***/.venv/lib/python3.10/site-packages/prefect_aws/s3.py", line 588, in _read_sync
s3_client = self._get_s3_client()
File "***/.venv/lib/python3.10/site-packages/prefect_aws/s3.py", line 456, in _get_s3_client
return self.credentials.get_client("s3")
File "***/.venv/lib/python3.10/site-packages/prefect_aws/credentials.py", line 173, in get_client
return _get_client_cached(ctx=self, client_type=client_type)
File "***/.venv/lib/python3.10/site-packages/prefect_aws/credentials.py", line 53, in _get_client_cached
**ctx.aws_client_parameters.get_params_override(),
AttributeError: 'dict' object has no attribute 'get_params_override'
Anh Pham
03/03/2024, 9:28 PMaws_client_parameters
from dict?Kevin Grismore
03/03/2024, 9:28 PMAnh Pham
03/03/2024, 9:28 PMAnh Pham
03/03/2024, 9:30 PMKevin Grismore
03/03/2024, 9:31 PMAnh Pham
03/03/2024, 10:15 PMAnh Pham
03/03/2024, 10:16 PMAnh Pham
03/04/2024, 12:21 AMJean-Michel Provencher
03/18/2024, 8:52 PMAttributeError: 'dict' object has no attribute 'get_params_override'
Did you manage to make it work ?
I'm using an S3Bucket block but I still get the error even with a brand new blockphilip
05/06/2024, 12:54 PMAnh Pham
05/30/2024, 11:44 AMAnh Pham
05/30/2024, 11:45 AMUnion[AwsCredentials, MinIOCredentials]
it works like charm.Anh Pham
05/30/2024, 11:48 AMaws_client_parameters
was not loaded to AwsClientParameters
but kept in dict
.Kevin Grismore
05/30/2024, 2:14 PMAnh Pham
06/07/2024, 12:21 PM