From 2a9499a1bdf49fbdbf7410c419b5282f26b68551 Mon Sep 17 00:00:00 2001 From: Ameer Haj Ali Date: Sat, 21 Nov 2020 23:04:24 +0200 Subject: [PATCH] [autoscaler] cover autofilling resources with try except. (#12222) Co-authored-by: Ameer Haj Ali Co-authored-by: Alex Wu Co-authored-by: Alex Wu Co-authored-by: Eric Liang Co-authored-by: Ameer Haj Ali --- python/ray/autoscaler/_private/commands.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/ray/autoscaler/_private/commands.py b/python/ray/autoscaler/_private/commands.py index c70fdf33e..922c2332b 100644 --- a/python/ray/autoscaler/_private/commands.py +++ b/python/ray/autoscaler/_private/commands.py @@ -270,8 +270,15 @@ def _bootstrap_config(config: Dict[str, Any], cli_logger.print("Checking {} environment settings", _PROVIDER_PRETTY_NAMES.get(config["provider"]["type"])) - - config = provider_cls.fillout_available_node_types_resources(config) + try: + config = provider_cls.fillout_available_node_types_resources(config) + except Exception as exc: + if cli_logger.verbosity > 2: + logger.exception("Failed to autodetect node resources.") + else: + cli_logger.warning( + f"Failed to autodetect node resources: {str(exc)}. " + "You can see full stack trace with higher verbosity.") # NOTE: if `resources` field is missing, validate_config for non-AWS will # fail (the schema error will ask the user to manually fill the resources)