Added option for availability zone (#1393)

This commit is contained in:
Peter Schafhalter
2018-01-09 13:49:47 -08:00
committed by Philipp Moritz
parent 112ef07563
commit a59a9e20af
3 changed files with 16 additions and 1 deletions
+1
View File
@@ -49,6 +49,7 @@ CLUSTER_CONFIG_SCHEMA = {
"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.
+14 -1
View File
@@ -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
+1
View File
@@ -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: