https://flyte.org logo
#ask-the-community
Title
# ask-the-community
j

Jonatan Eriksson

12/22/2023, 2:08 PM
Hello! I'm running a task that takes a FlyteFile as input and generates another FlyteFile as output. I'm trying to make caching work when running pyflyte in local mode. It doesn't work if the input type is FlyteFile, probably because it generates a new tempfile everytime I run the task. However, if I change the task input type to str instead of FlyteFile caching works as expected. Is there a way to get caching to work with FlyteFile when running in local mode, or is this the intended behavior?
s

Samhita Alla

12/22/2023, 4:04 PM
yes, you're right. you'll need to use
HashMethod
so that you can cache based on the file contents. here's an example to cache a dataframe: https://docs.flyte.org/projects/cookbook/en/latest/auto_examples/development_lifecycle/task_cache.html#how-does-caching-of-offloaded-objects-work if you specify where it should be uploaded to using
remote_path
, i believe that should hit the cache as well.
k

Ketan (kumare3)

12/22/2023, 4:07 PM
If you are passing a consistent float it should cache correctly
Does it work in remote
j

Jonatan Eriksson

12/22/2023, 5:31 PM
All right, I'll try that, thanks a lot!