https://prefect.io logo
Title
m

Marco Barbero Mota

05/16/2023, 5:56 PM
Hi all, A couple of questions: 1. Anyone could point me to what is the functionality in prefect 2.0 that does the same as
@task(LocalResult(dir='path/to/folder/for/storage),target='result.pkl',checkpoint=True)
2. In prefect 1.0, if a task returns a dictionary and I specify as above how to locally cache why may be getting that
result.pkl
only saves the last element in the dictionry? Thanks,
1
s

Stéphan Taljaard

05/16/2023, 5:58 PM
m

Marco Barbero Mota

05/16/2023, 6:00 PM
I was reading that documentation, but I am bit confused by the cache keys. It seems like they rely in the task input rather than if the resulting file exists or not.
z

Zanie

05/16/2023, 6:00 PM
You could write a custom cache key function that checks for the presence of a file
There’s just not one out of the box right now
m

Marco Barbero Mota

05/16/2023, 6:01 PM
Are there examples out there?
I see, and then how should I pass that to the @task decorator?
For anyone else interested, I ended up writing my own custom cache key function. I will be creating a public repo on my GitHub for anyone else that wants this functionality. Would be great if prefect could implement it in the package itself.
🙌 2