[Subnet Prioritization] Support capacity-optimized-prioritized and prioritized Allocation Strategy#671
Conversation
…leet call Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
…rams launching with EnableSingleAvailabilityZone and prioritized|capacity-optimized-prioritized AllocationStrategy Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
…ity-optimized-prioritized when using EnableSingleAvailabilityZone Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
…zed' is used with On-Demand Capacity and 'capacity-optimized-prioritized' is used with Spot Capacity type. Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
|
Update the PR description to mention what is no longer relevant |
…rrectly set with prioritized|capacity-optimized-prioritized AllocationStrategy and all_or_nothing ScalingStrategy Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
…rrectly set with prioritized|capacity-optimized-prioritized AllocationStrategy and all_or_nothing ScalingStrategy Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
Signed-off-by: Hanxuan Zhang <hanxuanz@amazon.com>
| for subnet_id in subnet_ids: | ||
| overrides.update({"InstanceType": instance_type["InstanceType"], "SubnetId": subnet_id}) | ||
| if self._uses_subnet_prioritization(): | ||
| overrides.update( |
There was a problem hiding this comment.
[CodeStyle] We could reduce code duplication by defining the common part of the dictionary just once, then add the priority to it if subnet prioritization is enabled.
| ------ | ||
|
|
||
| **CHANGES** | ||
| - Support prioritized and capacity-optimized-prioritized Allocation Strategy |
There was a problem hiding this comment.
The change log entry should be more focus on the user experience. Could even simply be "Support new allocation strategies prioritized and capacity-optimized-prioritized to take into account the subnet prioritization on scale out."
|
|
||
| def _uses_subnet_prioritization(self): | ||
| return ( | ||
| self._compute_resource_config.get("AllocationStrategy") == "prioritized" |
There was a problem hiding this comment.
[CodeStyle] "prioritized", "on-demand", "spot", "capacity-optimized-prioritized" should be defined as constants in an Enum within a common script (see how we did it in cli package: https://github.com/aws/aws-parallelcluster/blob/develop/cli/src/pcluster/config/common.py#L31-L36).
This is a good way to use the code as a way to document supported values, prevent constants to be redefined and potential errors caused by typos.
| subnet_ids = self._compute_resource_config.get("Networking", {}).get("SubnetIds", []) | ||
| return len(subnet_ids) == 1 | ||
|
|
||
| def _uses_subnet_prioritization(self): |
There was a problem hiding this comment.
[Tests] We are introducing a new function. We are testing it as part of the unit tests for the upper level function _evaluate_template_overrides. However, we should always add a specific unit test for every new function and mock its behavior in unit tests for the upper level one. In this way it's easier to decouple behavior and address defects in case of failures.
Description of changes
Tests
References
Checklist
developadd the branch name as prefix in the PR title (e.g.[release-3.6]).Please review the guidelines for contributing and Pull Request Instructions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.