-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-cachable products for @console_rules #6146
Comments
Sounds reasonable. Regarding 2: I take back this comment:
Computing it pre-dirtied wouldn't actually work. What we're doing here is creating it "pre-cleared"... do the Node/Entry would just stay in the |
@blorente Updated https://github.com/illicitonion/pants/tree/blorente/6146/no-cache-console-rules with some new commits - may be reviewable (possibly with some new code comments and possibly some new tests) |
@illicitonion, @blorente : That looks good! Please add a TODO next to the |
A
@console_rule
is a normal@rule
that results in a synthetic product. But since the execution of all@rule
s are memoized/cached,@console_rule
s currently only actually execute the first time they are requested (think./pants list
withpantsd
only outputting something the first time you run it).To fix this, we should not cache the result of running a
@console_rule
.Not caching the result of running a
@console_rule
might look like adding a newfn cacheable
method to the Node trait, and then implementingfn cacheable
for NodeKey::Task using the existing (but currently unused) cacheable flag.Passing the cacheable flag down to
Task
from python will involve editing thetasks_task_begin
function definition on the python side: https://github.com/pantsbuild/pants/blob/master/src/python/pants/engine/native.py#L171 and on the rust side: https://github.com/pantsbuild/pants/blob/master/src/rust/engine/src/lib.rs#L418-L423 ... and then fixing any runtime/compile errors that result! The@rule
created by@console_rule
should pass downcacheable=False
, and everything else should passTrue
.Finally (if there is time left! if not: can open a followup ticket for this portion), the last step is to use
Node::cacheable
in graph::Entry::complete to:else
case in that block)NotStarted
withprevious_result: None
(to definitely not store the result value).To integration test this, it should be possible to modify this test to run the
--v2
./pants list
command twice in a row.slack discussion re-paste for posterity:
The text was updated successfully, but these errors were encountered: