-
Notifications
You must be signed in to change notification settings - Fork 21
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
Force the planner to use a certain instance type #42
Open
anujphadke
wants to merge
2
commits into
Netflix-Skunkworks:main
Choose a base branch
from
anujphadke:service-capacity-modeling-filter-names
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,12 +177,21 @@ def _allow_hardware( | |
lifecycle: Lifecycle, | ||
allowed_names: Sequence[str], | ||
allowed_lifecycles: Sequence[Lifecycle], | ||
exact_match: bool | ||
) -> bool: | ||
|
||
# If the user has explicitly asked for particular families instead | ||
# of all lifecycles filter based on that | ||
if allowed_names: | ||
if name not in allowed_names: | ||
if exact_match: | ||
for allowed_name in allowed_names: | ||
if name == allowed_name: | ||
return True | ||
return False | ||
else: | ||
if name not in allowed_names: | ||
return False | ||
return True | ||
# Otherwise consider lifecycle (default) | ||
else: | ||
if lifecycle not in allowed_lifecycles: | ||
|
@@ -365,16 +374,17 @@ def _plan_certain( | |
|
||
plans = [] | ||
for instance in hardware.instances.values(): | ||
exact_match = instance.family_separator in instance.family | ||
if not _allow_hardware( | ||
instance.family, instance.lifecycle, instance_families, lifecycles | ||
instance.family, instance.lifecycle, instance_families, lifecycles, exact_match | ||
): | ||
continue | ||
|
||
if per_instance_mem > instance.ram_gib: | ||
continue | ||
|
||
for drive in hardware.drives.values(): | ||
if not _allow_hardware(drive.name, drive.lifecycle, drives, lifecycles): | ||
if not _allow_hardware(drive.name, drive.lifecycle, drives, lifecycles, False): | ||
continue | ||
|
||
plan = self._models[model_name].capacity_plan( | ||
|
@@ -578,4 +588,4 @@ def _sub_models( | |
|
||
|
||
planner = CapacityPlanner() | ||
planner.register_group(netflix.models) | ||
planner.register_group(netflix.models) | ||
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. nitpick: add back in a newline (UNIX mode not Windows) |
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.
This will always return true false. I think you want to do the for loop like I suggested inside the method against the strings in instance_families
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.
@jolynch - Does it make sense to have separate functions?
def _allow_instance
and
def _allow_drives
We use this function for the disk drives below on line 377. Should we keep this change specific to instance?
https://github.com/Netflix-Skunkworks/service-capacity-modeling/blob/main/service_capacity_modeling/capacity_planner.py#L377