David Ojeda
07/18/2019, 6:18 PM2019-07-18 20:12:28 ixion.local prefect.TaskRunner[22036] WARNING Task 'SlackTask': can't use cache because it is now invalid
… in my opinion, the message is misleading (there is no invalid cache, I have not setup any cache_for for this task) and maybe the warning level is too high for this case.
While I was reading the related code:
if self.task.cache_for is not None:
candidate_states = prefect.context.caches.get(
self.task.cache_key or self.task.name, []
)
sanitized_inputs = {key: res.value for key, res in inputs.items()}
for candidate in candidate_states:
if self.task.cache_validator(
candidate, sanitized_inputs, prefect.context.get("parameters")
):
candidate._result = candidate._result.to_result()
return candidate
self.logger.warning(
"Task '{name}': can't use cache because it "
"is now invalid".format(
name=prefect.context.get("task_full_name", self.task.name)
)
)
I wondered if the problem is just as simple as: the logging instruction was supposed to be indented one level deeper, so it happens when there 1) the cache is enabled and 2) there are cache candidates but all fail to hit.Chris White
David Ojeda
07/18/2019, 6:19 PM