mirror of
https://github.com/wassname/ray.git
synced 2026-07-12 11:59:20 +08:00
[autoscaler] Auto-replace "DEFAULT" with most recent DLAMI (#6848)
* try_this * fix * actual fix * default
This commit is contained in:
@@ -17,6 +17,22 @@ DEFAULT_RAY_INSTANCE_PROFILE = RAY + "-v1"
|
||||
DEFAULT_RAY_IAM_ROLE = RAY + "-v1"
|
||||
SECURITY_GROUP_TEMPLATE = RAY + "-{}"
|
||||
|
||||
DEFAULT_AMI_NAME = "AWS Deep Learning AMI (Ubuntu 18.04) V26.0"
|
||||
|
||||
# Obtained from https://aws.amazon.com/marketplace/pp/B07Y43P7X5 on 1/20/2020.
|
||||
DEFAULT_AMI = {
|
||||
"us-east-2": "ami-0bb99846db2df6e38", # US East (Ohio)
|
||||
"us-east-1": "ami-0698bcaf8bd9ef56d", # US East (N. Virginia)
|
||||
"us-west-1": "ami-074c29e29c500f623", # US West (N. California)
|
||||
"us-west-2": "ami-010a96c958f9ee5cf", # US West (Oregon)
|
||||
"ca-central-1": "ami-086b864eabf2da9b1", # Canada (Central)
|
||||
"eu-central-1": "ami-0dcdcc4bc9e75005f", # EU (Frankfurt)
|
||||
"eu-west-1": "ami-071e6d171b20431fb", # EU (Ireland)
|
||||
"eu-west-2": "ami-0470e741c969b62fc", # EU (London)
|
||||
"eu-west-3": "ami-064f884d98b90a453", # EU (Paris)
|
||||
"sa-east-1": "ami-054e94fd9b444491d", # SA (Sao Paulo)
|
||||
}
|
||||
|
||||
assert StrictVersion(boto3.__version__) >= StrictVersion("1.4.8"), \
|
||||
"Boto3 version >= 1.4.8 required, try `pip install -U boto3`"
|
||||
|
||||
@@ -49,6 +65,9 @@ def bootstrap_aws(config):
|
||||
# the group, and also SSH access from outside.
|
||||
config = _configure_security_group(config)
|
||||
|
||||
# Provide a helpful message for missing AMI.
|
||||
_check_ami(config)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
@@ -250,6 +269,34 @@ def _configure_security_group(config):
|
||||
return config
|
||||
|
||||
|
||||
def _check_ami(config):
|
||||
"""Provide helpful message for missing ImageId for node configuration."""
|
||||
|
||||
region = config["provider"]["region"]
|
||||
default_ami = DEFAULT_AMI.get(region)
|
||||
if not default_ami:
|
||||
# If we do not provide a default AMI for the given region, noop.
|
||||
return
|
||||
|
||||
if config["head_node"].get("ImageId", "").lower() == "DEFAULT":
|
||||
config["head_node"]["ImageId"] = default_ami
|
||||
logger.info("_check_ami: head node ImageId specified as 'DEFAULT'. "
|
||||
"Using '{ami_id}', which is the default {ami_name} "
|
||||
"for your region ({region}).".format(
|
||||
ami_id=default_ami,
|
||||
ami_name=DEFAULT_AMI_NAME,
|
||||
region=region))
|
||||
|
||||
if config["worker_nodes"].get("ImageId", "").lower() == "DEFAULT":
|
||||
config["worker_nodes"]["ImageId"] = default_ami
|
||||
logger.info("_check_ami: worker nodes ImageId specified as 'DEFAULT'. "
|
||||
"Using '{ami_id}', which is the default {ami_name} "
|
||||
"for your region ({region}).".format(
|
||||
ami_id=default_ami,
|
||||
ami_name=DEFAULT_AMI_NAME,
|
||||
region=region))
|
||||
|
||||
|
||||
def _get_vpc_id_or_die(config, subnet_id):
|
||||
ec2 = _resource("ec2", config)
|
||||
subnet = list(
|
||||
|
||||
Reference in New Issue
Block a user