-
Notifications
You must be signed in to change notification settings - Fork 7.2k
[AWS] Stop Round Robining AZs #19051
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1df368b
round robin on failure to launch
ijrsvt 35a4f3d
still round-robin spot instances
ijrsvt ec7fc18
prioritize first AZ
ijrsvt b7c2d73
no more round-robining
ijrsvt 059de8b
doc updates
ijrsvt ca986e7
Order subnets by AZ
ijrsvt aa6a9d2
add spot instance advisor link
ijrsvt f23f9d8
ensure we try all AZs
ijrsvt 60ef04d
fix typos
ijrsvt 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ | |
| import pytest | ||
| from unittest.mock import Mock, patch | ||
|
|
||
| from ray.autoscaler._private.aws.config import _get_vpc_id_or_die, \ | ||
| bootstrap_aws, log_to_cli, \ | ||
| from ray.autoscaler._private.aws.config import _configure_subnet, \ | ||
| _get_vpc_id_or_die, bootstrap_aws, log_to_cli, \ | ||
| DEFAULT_AMI | ||
| from ray.autoscaler._private.aws.node_provider import AWSNodeProvider | ||
| from ray.autoscaler._private.providers import _get_node_provider | ||
|
|
@@ -694,6 +694,32 @@ def mock_get_cached_node(node_id): | |
| assert nodes_to_include_in_call == nodes_included_in_call | ||
|
|
||
|
|
||
| def test_use_subnets_ordered_by_az(ec2_client_stub): | ||
|
||
| """ | ||
| This test validates that when bootstrap_aws populates the SubnetIds field, | ||
| the subnets are ordered the same way as availability zones. | ||
|
|
||
| """ | ||
| # Add a response with a twenty subnets round-robined across the 4 AZs in | ||
| # `us-west-2` (a,b,c,d). At the end we should only have 15 subnets, ordered | ||
| # first from `us-west-2c`, then `us-west-2d`, then `us-west-2a`. | ||
| stubs.describe_twenty_subnets_in_different_azs(ec2_client_stub) | ||
|
|
||
| base_config = helpers.load_aws_example_config_file("example-full.yaml") | ||
| base_config["provider"][ | ||
| "availability_zone"] = "us-west-2c,us-west-2d,us-west-2a" | ||
| config = _configure_subnet(base_config) | ||
|
|
||
| # We've filtered down to only subnets in 2c, 2d & 2a | ||
| for node_type in config["available_node_types"].values(): | ||
| node_config = node_type["node_config"] | ||
| assert len(node_config["SubnetIds"]) == 15 | ||
| offsets = [int(s.split("-")[1]) % 4 for s in node_config["SubnetIds"]] | ||
| assert set(offsets[:5]) == {2}, "First 5 should be in us-west-2c" | ||
| assert set(offsets[5:10]) == {3}, "Next 5 should be in us-west-2d" | ||
| assert set(offsets[10:15]) == {0}, "Last 5 should be in us-west-2a" | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| import sys | ||
| sys.exit(pytest.main(["-v", __file__])) | ||
This file contains hidden or 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 hidden or 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
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.
For this statement to be true, I think we also need to change https://github.com/ray-project/ray/blob/master/python/ray/autoscaler/_private/aws/config.py#L443
From:
subnets = [s for s in subnets if s.availability_zone in azs]To:
subnets = [s for az in azs for s in subnets if s.availability_zone == az]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.
Wow, great catch! I changed this and added a test for this!