Hello! I'm running a task that takes a FlyteFile a...
# ask-the-community
j
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
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
If you are passing a consistent float it should cache correctly
Does it work in remote
j
All right, I'll try that, thanks a lot!