mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[autoscaler] Fix Defaults (#1661)
This commit is contained in:
parent
2b747ba46c
commit
40799fee37
1 changed files with 5 additions and 3 deletions
|
@ -503,14 +503,16 @@ def check_required(config, schema):
|
|||
def check_extraneous(config, schema):
|
||||
"""Make sure all items of config are in schema"""
|
||||
if type(config) is not dict:
|
||||
raise ValueError("Config is not a dictionary")
|
||||
raise ValueError("Config {} is not a dictionary".format(config))
|
||||
for k in config:
|
||||
if k not in schema:
|
||||
raise ValueError(
|
||||
"Unexpected config key `{}` not in {}".format(
|
||||
k, list(schema.keys())))
|
||||
v, kreq = schema[k]
|
||||
if isinstance(v, type):
|
||||
if v is None:
|
||||
continue
|
||||
elif isinstance(v, type):
|
||||
if not isinstance(config[k], v):
|
||||
raise ValueError(
|
||||
"Config key `{}` has wrong type {}, expected {}".format(
|
||||
|
@ -522,7 +524,7 @@ def check_extraneous(config, schema):
|
|||
def validate_config(config, schema=CLUSTER_CONFIG_SCHEMA):
|
||||
"""Required Dicts indicate that no extra fields can be introduced."""
|
||||
if type(config) is not dict:
|
||||
raise ValueError("Config is not a dictionary")
|
||||
raise ValueError("Config {} is not a dictionary".format(config))
|
||||
|
||||
check_required(config, schema)
|
||||
check_extraneous(config, schema)
|
||||
|
|
Loading…
Add table
Reference in a new issue