Hi there, good job on your 0.6.0 version… It solve...
# prefect-community
d
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:
Copy code
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:
Copy 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.
c
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
d
🙂