-
-
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
[engine] Split SelectDependencies into SelectDependencies and SelectTransitive #4334
[engine] Split SelectDependencies into SelectDependencies and SelectTransitive #4334
Conversation
…ve is created on the rust side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Peiyu... looks good!
@@ -121,13 +120,26 @@ def __repr__(self): | |||
field_name_portion = ', {}'.format(repr(self.field)) | |||
else: | |||
field_name_portion = '' | |||
return '{}({}, {}{}{}{})'.format(type(self).__name__, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this overridden repr
is still used anywhere... may be able to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, correction... it's used only in unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea
src/python/pants/engine/selectors.py
Outdated
field_types_portion) | ||
|
||
|
||
class SelectTransitive(datatype('Dependencies', ['product', 'dep_product', 'field', 'field_types']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Dependencies/Transitive/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
src/rust/engine/src/nodes.rs
Outdated
} | ||
|
||
fn store(&self, dep_product: &Value, dep_values: Vec<&Value>) -> Value { | ||
// Not an inner node, or not a traversal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is probably stale. But also, you can probably just inline this into the caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inlined.
…esses within SelectTransitive (#4349) ### Problem As described in #4283, the issue with recursively executing `SelectTransitive` is lots of calls to `store_list` creating massive intermediate lists that increases memory footprint as well as impacts perf. ### Solution Same idea as in #4265 using `loop_fn` rewrite `SelectTransitive` to execute iteratively. One small difference is in order to use `OrderMap` and `HashSet` for state tracking and outputs are in `Value`s, those `Values` are turned into `Key`s. ps: previous PR #4334 paved way for this optimization by splitting `SelectTransitive` from `SelectDependencies(...transitive=true)`. ### Result All existing tests pass. Have verified there is only one `ST` node through viz. Two follow up items * #4358 reenable cycle detection * #3925 Remove BFA now not only is a clean up task, but has performance benefits because the second round hydration is on `Address` which is redundant.
…ransitive (pantsbuild#4334) ### Problem This is a refactoring change with no functionalities added. it will simplify pantsbuild#4283 so we could optimize just for `SelectTransitive`. ### Solution Introduce `SelectTransitive` with identical attributes with `SelectDependencies` (for now), and split the `if` `else` switch in node handling into each node. With that, `transitive` flag is not needed. ### Result Test all passes.
…esses within SelectTransitive (pantsbuild#4349) ### Problem As described in pantsbuild#4283, the issue with recursively executing `SelectTransitive` is lots of calls to `store_list` creating massive intermediate lists that increases memory footprint as well as impacts perf. ### Solution Same idea as in pantsbuild#4265 using `loop_fn` rewrite `SelectTransitive` to execute iteratively. One small difference is in order to use `OrderMap` and `HashSet` for state tracking and outputs are in `Value`s, those `Values` are turned into `Key`s. ps: previous PR pantsbuild#4334 paved way for this optimization by splitting `SelectTransitive` from `SelectDependencies(...transitive=true)`. ### Result All existing tests pass. Have verified there is only one `ST` node through viz. Two follow up items * pantsbuild#4358 reenable cycle detection * pantsbuild#3925 Remove BFA now not only is a clean up task, but has performance benefits because the second round hydration is on `Address` which is redundant.
Problem
This is a refactoring change with no functionalities added. it will simplify #4283 so we could optimize just for
SelectTransitive
.Solution
Introduce
SelectTransitive
with identical attributes withSelectDependencies
(for now), and split theif
else
switch in node handling into each node. With that,transitive
flag is not needed.Result
Test all passes.