wanted to get some opinions about a way to approac...
# development
h
wanted to get some opinions about a way to approach https://github.com/pantsbuild/pants/issues/10129, particularly @witty-crayon-22786
I have a draft PR (https://github.com/pantsbuild/pants/pull/10433) that tries to fix this by making the
cacheable
method on
Node
depend on
Node::Item
, i.e. making its signature
fn cacheable(&self, result: Option<&Self::Item>) -> bool;
w
it would need to be a “static” method, probably. ie, not taking self.
h
and then in the specific case of a specially-marked
MultiPlatformProcess
node, we have the return value of
cacheable
depend on whether the
Process
has a certian flag and also whether its output
ProcessResult
was successful or not
@witty-crayon-22786 the code seems to compile without changing the signature of
cacheable
to remove the
self
, although it's possible we don't need that anyway
w
so, actually. taking a step back
h
I"m not sure if this is the best appraoch
we use
cacheable
in more places in
graph
htan I thought we did
w
yea
so, here’s the thing.
hm. ok, this will take some thinking. sorry, can respond in a bit
h
no worries, happy to talk about it a bit later
or tomorrow if you're heading off for the day
w
so… i think that maybe the method that you have is fine. the other alternative would be a new static method called
cacheable_item(..)
, but you would call them both in all of the same places
to avoid forgetting to call both, you could add a method to
Entry
in
<http://entry.rs|entry.rs>
that would call both on
&self
the thing about having one cacheable method that takes both self and the item is that it isn’t strictly necessary for
self
to match the item (ie, it doesn’t matter that self is a ProcessRequest and the item is a ProcessResult… you use self and the item for independent checks, basically)
but minor.
h
@witty-crayon-22786 but the basic idea that the cacheability of a
Node
depends on both the node object itself and its output is sound, right?
or rather, that it will depend on that with my change?
I'm not sure it matters much whether where's a separate `cacheable_item`method or that code is part of the
cacheable
implementation, I think it could go either way
I just don't have the solution in the draft PR working yet, and I think that's because in the several call sites of
Node::cacheable
, we don't necessarily have the node output value availalable. at least right now with that version of the code the bug in pantsd is not fixed
w
but the basic idea that the cacheability of a 
Node
 depends on both the node object itself and its output is sound, right?
yea, i think it is.
lemme know if you want me to take a look at the draft