Skip to content
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

[autoscaler] can specify availability zone #1393

Merged
merged 1 commit into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added option for availability zone
  • Loading branch information
pschafhalter committed Jan 6, 2018
commit 066633ecf780c9b1ec39ab96b40f440fb78cdd9c
1 change: 1 addition & 0 deletions python/ray/autoscaler/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"provider": {
"type": str, # e.g. aws
"region": str, # e.g. us-east-1
"availability_zone": str, # e.g. us-east-1a
},

# How Ray will authenticate with newly launched nodes.
Expand Down
15 changes: 14 additions & 1 deletion python/ray/autoscaler/aws/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,20 @@ def _configure_subnet(config):
"No subnets found, try manually creating an instance in "
"your specified region to populate the list of subnets "
"and trying this again.")
default_subnet = subnets[0]
if "availability_zone" in config["provider"]:
default_subnet = next((s for s in subnets
if s.availability_zone ==
config["provider"]["availability_zone"]),
None)
if not default_subnet:
raise Exception(
"No available subnets matching availability zone {} "
"found. Choose a different availability zone or try "
"manually creating an instance in your specified region "
"to populate the list of subnets and trying this again."
.format(config["provider"]["availability_zone"]))
else:
default_subnet = subnets[0]

if "SubnetId" not in config["head_node"]:
config["head_node"]["SubnetId"] = default_subnet.id
Expand Down
1 change: 1 addition & 0 deletions python/ray/autoscaler/aws/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ idle_timeout_minutes: 5
provider:
type: aws
region: us-west-2
# availability_zone: us-west-2a

# How Ray will authenticate with newly launched nodes.
auth:
Expand Down