Hey I'm using the caching functionality by specify...
# prefect-community
a
Hey I'm using the caching functionality by specifying a
target
file as a task parameter. So if this target file is present it should skip the execution of this task. I want to choose to programmatically (eg. through a parameter) force execution of this task (and thus ignoring/overwriting the target file). I first thought using the
cache_validator
task parameter would be the way to go, but I see in the documentation that it is deprecated. Is there a recommended way to achieve this behavior? Thanks
c
Hi @as - currently the only way to do so is by removing the file yourself. I suggest templating your target file path to take into account the situations in which you want the task to rerun (e.g., template the path with a parameter or a datetime value)
a
Okay, thanks. I think I got it. You mean to change the value of the
target
parameter of task conditionally on some other parameter (that switches on/off the forced evaluation)
c
yup exactly
For the most flexibility you should let the parameter value be an arbitrary string, so that you can always have the option to force run the task without deleting files
a
okay, thanks a lot for the tip!