Q regarding rule caching. :thread:
# development
c
Q regarding rule caching. 🧵
I realize that rule arguments are used to invalidate a rule, but how about Get requests executed during a rule body, if any of those dependent rules are invalidated does that also invalidate the first rule? Example will probably do a better job at illustrating what I’m asking:
Copy code
rule R(A, B) -> Get(Environment, EnvironmentRequest(X)) -> Result
now, if the value for
X
changes, does that invalidate rule
R
too?
e.g. the
Get
request is the same, it would only be the resulting environment response that has a changed value.
f
thus changes will cause rule invalidation
the Pants engine actually parses the source of the rule and extracts
Get
instances in order to do that registration
see
src/python/pants/engine/internals/rule_visitor.py
for details of the source parsing
c
Thanks. I’m aware of how the Gets are parsed into the rule info, missed the bit about them being registered as edges and what that implied 🙂
still a bit fuzzy for me how the actual values for these edges affect invalidation/caching..
🤔 guess only inputs can affect caching, as the return value would only ever be the case when requested by a rule being evaluated, so the return value will be consumed regardless… OK, I think that makes more sense to me now. Thanks Tom!