I'm confused about the `cache_key_fn` (and the def...
# pacc-aug-28-29-2024
s
I'm confused about the
cache_key_fn
(and the default one mentioned). It would help to see an example of a custom one.
1
Oh,
task_input_hash
meaning, what's the hash (some unique, portable representation of all inputs) for the inputs/parameters of a task?
👍 1
yess 2
b
You can define a task that is cached based on its inputs by using the Prefect
task_input_hash
. This is a task cache key implementation that hashes all inputs to the task using a JSON or cloudpickle serializer. If the task inputs do not change, the cached results are used rather than running the task until the cache expires.
❤️ 1
i can try to find a custom example to show you
s
That all jives with me. Powerful when you're passing custom classes and various types of input parameters. I can loosely imagine what a custom one might look like. E.g., if you need something that cloudpickle can't deal with directly.