I have a question about flyte caching when running workflows as standard python functions for example in local testing -- i.e., not by running
pflyte run
from the CLI, but rather just executing the python workflow function directly.
In this case, how best to disable caching? I see that work has been done to give
pyflyte run
some local-cache options, but that doesn't apply here.
In my codebase, I use a global flag that is typically always on to allow/disallow caching like
@task( cache=GLOBAL_CACHING_ENABLED ... )
If I take care to turn this flag OFF in my test module BEFORE the module containing the task is loaded, I can disable caching this way. But it would be nice if there were a more programmatic way to do this that didn't rely as much on order of module loading - just something to say, "hey, flytekit, turn off local caching please!"
From the flyte console when "relaunching" a workflow on our k8s cluster, or from code that launches jobs programmatically via FlyteRemote, I can pass an
overwrite_cache
parameter. Is there some flytekit API I can call to turn off local caching in a similar way? I see reference to
LocalTaskCache.clear()
in
this PR, but I don't find docs about it. The other option would seem to be executing
pyflyte local-cache clear
in a subprocess during the test, but this feels pretty hacky in a test that's running a very-fast workflow a few times to ensure results are either all different or all the same (which caching gets in the way of).
Thoughts?
Thanks!