Can retries of a flow use no cache? I have a retry...
# ask-community
l
Can retries of a flow use no cache? I have a retry set in my flow decorator that always fails because we don't do any task result caching I get the error:
Copy code
raise ValueError(f"Path {path} does not exist.")
ValueError: Path /root/.prefect/storage/<ID> does not exist.
This is with
prefect==2.18.3
- worker on k8s
n
hi @Leon Kozlowski - are you using containers here?
l
Yes
n
ope sorry, i missed that last sentence
l
can I just set
Copy code
os.environ["PREFECT_TASKS_REFRESH_CACHE"] = "true"
at runtime?
n
there's a util,
temporary_settings
for patching settings at runtime, but that seems like maybe a bit more heavy-handed than should be necessary the best course of action imo, assuming you need to persist results for the sake of retries, is to define a
PREFECT_DEFAULT_RESULT_STORAGE_BLOCK
like
s3/my-bucket
so that your results aren't persisting to a container that dies (which is what I would guess is happening now)
l
I don't need to persist results
n
do you need retries that start from the last completed state?
l
I want retries to restart entire flow ideally
n
oh okay, i guess im confused why it's retrying to read a result path at all then
l
I think that is the default behavior
n
so yeah, i would suggest a default result storage your refresh cache suggestion would likely work, but i would not recommend that
c
FYI on this -- we overhauled this behavior in 3.x so now the non-existence of a result in storage is equivalent to the lack of a cache, and the task will rerun instead of error out. In general result storage and caching is more transparent and robust in 3.x
upvote 2
l
I'm not in a place to migrate to 3.0 unless I can guarantee backward compatibility with my worker - with this being a major version upgrade I would not suspect that to be true
👍 1