mirror of
https://github.com/vale981/ray
synced 2025-03-06 18:41:40 -05:00
Propagate Boto exception instead of overwriting. (#15564)
This commit is contained in:
parent
7bbf482070
commit
74cbf026ce
5 changed files with 14 additions and 31 deletions
|
@ -337,11 +337,7 @@ def _configure_key_pair(config):
|
||||||
"No matching local key file for any of the key pairs in this "
|
"No matching local key file for any of the key pairs in this "
|
||||||
"account with ids from 0..{}. "
|
"account with ids from 0..{}. "
|
||||||
"Consider deleting some unused keys pairs from your account.",
|
"Consider deleting some unused keys pairs from your account.",
|
||||||
key_name) # todo: err msg
|
key_name)
|
||||||
raise ValueError(
|
|
||||||
"No matching local key file for any of the key pairs in this "
|
|
||||||
"account with ids from 0..{}. ".format(key_name) +
|
|
||||||
"Consider deleting some unused keys pairs from your account.")
|
|
||||||
|
|
||||||
cli_logger.doassert(
|
cli_logger.doassert(
|
||||||
os.path.exists(key_path), "Private key file " + cf.bold("{}") +
|
os.path.exists(key_path), "Private key file " + cf.bold("{}") +
|
||||||
|
@ -391,13 +387,8 @@ def _configure_subnet(config):
|
||||||
"and trying this again.\n"
|
"and trying this again.\n"
|
||||||
"Note that the subnet must map public IPs "
|
"Note that the subnet must map public IPs "
|
||||||
"on instance launch unless you set `use_internal_ips: true` in "
|
"on instance launch unless you set `use_internal_ips: true` in "
|
||||||
"the `provider` config.") # todo: err msg
|
"the `provider` config.")
|
||||||
raise Exception(
|
|
||||||
"No usable subnets found, try manually creating an instance in "
|
|
||||||
"your specified region to populate the list of subnets "
|
|
||||||
"and trying this again. Note that the subnet must map public IPs "
|
|
||||||
"on instance launch unless you set 'use_internal_ips': True in "
|
|
||||||
"the 'provider' config.")
|
|
||||||
if "availability_zone" in config["provider"]:
|
if "availability_zone" in config["provider"]:
|
||||||
azs = config["provider"]["availability_zone"].split(",")
|
azs = config["provider"]["availability_zone"].split(",")
|
||||||
subnets = [s for s in subnets if s.availability_zone in azs]
|
subnets = [s for s in subnets if s.availability_zone in azs]
|
||||||
|
@ -407,13 +398,7 @@ def _configure_subnet(config):
|
||||||
"Choose a different availability zone or try "
|
"Choose a different availability zone or try "
|
||||||
"manually creating an instance in your specified region "
|
"manually creating an instance in your specified region "
|
||||||
"to populate the list of subnets and trying this again.",
|
"to populate the list of subnets and trying this again.",
|
||||||
config["provider"]["availability_zone"]) # todo: err msg
|
config["provider"]["availability_zone"])
|
||||||
raise Exception(
|
|
||||||
"No usable 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"]))
|
|
||||||
|
|
||||||
# Use subnets in only one VPC, so that _configure_security_groups only
|
# Use subnets in only one VPC, so that _configure_security_groups only
|
||||||
# needs to create a security group in this one VPC. Otherwise, we'd need
|
# needs to create a security group in this one VPC. Otherwise, we'd need
|
||||||
|
|
|
@ -399,12 +399,12 @@ class AWSNodeProvider(NodeProvider):
|
||||||
break
|
break
|
||||||
except botocore.exceptions.ClientError as exc:
|
except botocore.exceptions.ClientError as exc:
|
||||||
if attempt == BOTO_CREATE_MAX_RETRIES:
|
if attempt == BOTO_CREATE_MAX_RETRIES:
|
||||||
# todo: err msg
|
|
||||||
cli_logger.abort(
|
cli_logger.abort(
|
||||||
"Failed to launch instances. Max attempts exceeded.")
|
"Failed to launch instances. Max attempts exceeded.",
|
||||||
raise exc
|
exc=exc,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
cli_logger.print(
|
cli_logger.warning(
|
||||||
"create_instances: Attempt failed with {}, retrying.",
|
"create_instances: Attempt failed with {}, retrying.",
|
||||||
exc)
|
exc)
|
||||||
return created_nodes_dict
|
return created_nodes_dict
|
||||||
|
|
|
@ -610,7 +610,10 @@ class _CliLogger():
|
||||||
exc_cls = click.ClickException
|
exc_cls = click.ClickException
|
||||||
if self.pretty:
|
if self.pretty:
|
||||||
exc_cls = SilentClickException
|
exc_cls = SilentClickException
|
||||||
raise exc_cls("Exiting due to cli_logger.abort()")
|
|
||||||
|
if msg is None:
|
||||||
|
msg = "Exiting due to cli_logger.abort()"
|
||||||
|
raise exc_cls(msg)
|
||||||
|
|
||||||
def doassert(self, val: bool, msg: str, *args: Any, **kwargs: Any):
|
def doassert(self, val: bool, msg: str, *args: Any, **kwargs: Any):
|
||||||
"""Handle assertion without throwing a scary exception.
|
"""Handle assertion without throwing a scary exception.
|
||||||
|
|
|
@ -190,7 +190,6 @@ def create_or_update_cluster(
|
||||||
cli_logger.abort(
|
cli_logger.abort(
|
||||||
"Provided cluster configuration file ({}) does not exist",
|
"Provided cluster configuration file ({}) does not exist",
|
||||||
cf.bold(config_file))
|
cf.bold(config_file))
|
||||||
raise
|
|
||||||
except yaml.parser.ParserError as e:
|
except yaml.parser.ParserError as e:
|
||||||
handle_yaml_error(e)
|
handle_yaml_error(e)
|
||||||
raise
|
raise
|
||||||
|
@ -211,8 +210,6 @@ def create_or_update_cluster(
|
||||||
k for k in _NODE_PROVIDERS.keys()
|
k for k in _NODE_PROVIDERS.keys()
|
||||||
if _NODE_PROVIDERS[k] is not None
|
if _NODE_PROVIDERS[k] is not None
|
||||||
]))
|
]))
|
||||||
raise NotImplementedError("Unsupported provider {}".format(
|
|
||||||
config["provider"]))
|
|
||||||
|
|
||||||
printed_overrides = False
|
printed_overrides = False
|
||||||
|
|
||||||
|
@ -644,9 +641,8 @@ def get_or_create_head_node(config: Dict[str, Any],
|
||||||
with cli_logger.group("Fetching the new head node"):
|
with cli_logger.group("Fetching the new head node"):
|
||||||
while True:
|
while True:
|
||||||
if time.time() - start > 50:
|
if time.time() - start > 50:
|
||||||
cli_logger.abort(
|
cli_logger.abort("Head node fetch timed out. "
|
||||||
"Head node fetch timed out.") # todo: msg
|
"Failed to create head node.")
|
||||||
raise RuntimeError("Failed to create head node.")
|
|
||||||
nodes = provider.non_terminated_nodes(head_node_tags)
|
nodes = provider.non_terminated_nodes(head_node_tags)
|
||||||
if len(nodes) == 1:
|
if len(nodes) == 1:
|
||||||
head_node = nodes[0]
|
head_node = nodes[0]
|
||||||
|
|
|
@ -120,7 +120,6 @@ class NodeUpdater:
|
||||||
"Either do not pass `--redirect-command-output` "
|
"Either do not pass `--redirect-command-output` "
|
||||||
"or also pass in `--use-normal-shells`.")
|
"or also pass in `--use-normal-shells`.")
|
||||||
cli_logger.abort(msg)
|
cli_logger.abort(msg)
|
||||||
raise click.ClickException(msg)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with LogTimer(self.log_prefix +
|
with LogTimer(self.log_prefix +
|
||||||
|
|
Loading…
Add table
Reference in a new issue