[autoscaler] Refactor multi node type autoscaler config (#10190)

This commit is contained in:
Eric Liang
2020-08-19 20:46:00 -07:00
committed by GitHub
parent 2fd59de05d
commit 538cb802d5
11 changed files with 219 additions and 120 deletions
+16
View File
@@ -70,6 +70,22 @@ def validate_config(config: Dict[str, Any]) -> None:
"machine and make sure the versions match.".format(
ray_version=ray.__version__))
if "available_node_types" in config:
if "head_node_type" not in config:
raise ValueError(
"You must specify `head_node_type` if `available_node_types "
"is set.")
if config["head_node_type"] not in config["available_node_types"]:
raise ValueError(
"`head_node_type` must be one of `available_node_types`.")
if "worker_default_node_type" not in config:
raise ValueError("You must specify `worker_default_node_type` if "
"`available_node_types is set.")
if (config["worker_default_node_type"] not in config[
"available_node_types"]):
raise ValueError("`worker_default_node_type` must be one of "
"`available_node_types`.")
def prepare_config(config):
with_defaults = fillout_defaults(config)