-
Notifications
You must be signed in to change notification settings - Fork 427
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
reduce cost of large variant matrix #5392
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9f5ef06
discard unused variants before copying metadata
minrk 568aed3
try reducing with all used vars instead of loop vars
minrk 0797c42
perf: copy distributed variants list after subsetting
minrk 8bcbf09
perf: pass used_vars subset to get_loop_vars
minrk d1ba529
remove redundant deepcopy of config.variant
minrk 5007189
Merge branch 'main' into reduce_variants
beckermr 5f48708
add config.copy_variants method
minrk 0df82cc
Merge branch 'main' into reduce_variants
beckermr 644baaf
Update news/5392-variant-copy
beeankha 311e48b
Add benchmark test for `render_recipe` (#5490)
kenodegard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2288,7 +2288,6 @@ def validate_features(self): | |
def copy(self: Self) -> MetaData: | ||
new = copy.copy(self) | ||
new.config = self.config.copy() | ||
new.config.variant = copy.deepcopy(self.config.variant) | ||
new.meta = copy.deepcopy(self.meta) | ||
new.type = getattr( | ||
self, "type", "conda_v2" if self.config.conda_pkg_format == "2" else "conda" | ||
|
@@ -2672,15 +2671,16 @@ def get_output_metadata_set( | |
_check_run_constrained(output_tuples) | ||
return output_tuples | ||
|
||
def get_loop_vars(self): | ||
return get_vars(getattr(self.config, "input_variants", self.config.variants)) | ||
def get_loop_vars(self, subset=None): | ||
return get_vars( | ||
getattr(self.config, "input_variants", self.config.variants), subset=subset | ||
) | ||
|
||
def get_used_loop_vars(self, force_top_level=False, force_global=False): | ||
loop_vars = self.get_loop_vars() | ||
used_vars = self.get_used_vars( | ||
force_top_level=force_top_level, force_global=force_global | ||
) | ||
return set(loop_vars).intersection(used_vars) | ||
return self.get_loop_vars(subset=used_vars) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get_loop_vars is far cheaper if we pass a subset to consider instead of computing the (usually quite small) intersection after looping over all variables across all variants. |
||
|
||
def get_rendered_recipe_text( | ||
self, permit_undefined_jinja=False, extract_pattern=None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Enhancements | ||
|
||
* Reduce render time when there is a large number of unused variants. (#5392) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
config.copy on the line before already does exactly this, no need to do it twice