Repository navigation
Concurrent pantsd: Swap uncacheability for run-scoped results - #23616
Conversation
|
|
||
| fn has_uncacheable_deps(&self) -> bool { | ||
| /// The Run which may consume this result, if it is confined to one. | ||
| fn uncacheable_run_id(&self) -> Option<RunId> { |
There was a problem hiding this comment.
uncacheable_run_id doesn't stand out to me as a very descriptive name. Maybe include some concept of the fact that it is the run ID for another consumer (going by the comment "may consume this result")?
Also, overall, what happens if there is more than one consumer of the result? (I'm reacting to the comment saying "if it is confined to one."
There was a problem hiding this comment.
Renamed to run_scope. It's the Run that produced the result, not another consumer's. All of consumers within that Run share the result, but other runs will treat it as dirty, always.
| let (entered_tx, entered_rx) = watch::channel(false); | ||
| let (release_tx, release_rx) = watch::channel(false); |
There was a problem hiding this comment.
Why a Tokio watch instead of a one-shot channel? Watches would generally be used for passing around values like configuration data and are multi-producer, multi-consumer. Am I missing something?
There was a problem hiding this comment.
I was trying to avoid a mutex, which I now realize was not worth it. Switched!
A Run which attaches to another Run's in-flight attempt cannot consume its run-scoped result, so it re-enters to compute its own.
Names the result, generation and run_scope fields.
complete() sets the generation and run scope itself.
ea53f7a to
5a2f35f
Compare
5a2f35f to
4fe1ae7
Compare
NodeResult holds the producing RunId in place of an "uncacheable" bool. A Run that attaches to an in-flight attempt started by another Run re-enters get_node_result instead of taking that attempt's result.
Nothing can observe another Run's attempt under the pantsd concurrency lock, so this change is behaviour-preserving work.
See https://docs.google.com/document/d/1XEO55efGI8x91wGiVjmlFpUORJeQpZ2xF4zQoSE4TuY/edit?tab=t.0#heading=h.apz3211m77eg for design intent.