David Ojeda

07/18/2019, 6:18 PM
Hi there, good job on your 0.6.0 version… It solved many of my cache problems that I had to work around. One comment though, now, if I have a task that is totally unrelated with a cache mechanism, the logs now have some warning pollution, for example:
2019-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, []
            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

            "Task '{name}': can't use cache because it "
            "is now invalid".format(
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

07/18/2019, 6:19 PM
Hey @David Ojeda - yea, I’m really sorry that this snuck into 0.6.0. I fixed it with a PR yesterday, and it’s exactly as simple as you suggest -> essentially just indenting that log

David Ojeda

07/18/2019, 6:19 PM