Adam
02/02/2025, 7:53 PMValueError: Unable to create hash - objects could not be serialized.
JSON error: Unable to serialize unknown type: <class 'postgres_client.PostgresClient'>
Pickle error: cannot pickle 'psycopg2.extensions.connection' object
This often occurs when task inputs contain objects that cannot be cached like locks, file handles, or other system resources.
To resolve this, you can:
1. Exclude these arguments by defining a custom `cache_key_fn`
2. Disable caching by passing `cache_policy=NO_CACHE`
how come?Marvin
02/02/2025, 7:53 PMcache_policy=NO_CACHE
. This will prevent Prefect from attempting to serialize and cache the task inputs.
3. Result Persistence: Ensure that result persistence is off if you don't need it, as caching requires result persistence, which is off by default.
For further details, you might want to explore the Prefect GitHub issues related to serialization and caching for additional context and solutions.