mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 18:45:03 +08:00
[autoscaler] Bad error message when dict field omitted (#1632)
* Wed Feb 28 23:22:55 PST 2018 * Wed Feb 28 23:24:07 PST 2018
This commit is contained in:
@@ -467,6 +467,13 @@ class StandardAutoscaler(object):
|
||||
suffix, self.load_metrics.debug_string())
|
||||
|
||||
|
||||
def typename(v):
|
||||
if isinstance(v, type):
|
||||
return v.__name__
|
||||
else:
|
||||
return type(v).__name__
|
||||
|
||||
|
||||
def validate_config(config, schema=CLUSTER_CONFIG_SCHEMA):
|
||||
if type(config) is not dict:
|
||||
raise ValueError("Config is not a dictionary")
|
||||
@@ -476,7 +483,7 @@ def validate_config(config, schema=CLUSTER_CONFIG_SCHEMA):
|
||||
if k not in config:
|
||||
raise ValueError(
|
||||
"Missing required config key `{}` of type {}".format(
|
||||
k, v.__name__))
|
||||
k, typename(v)))
|
||||
if isinstance(v, type):
|
||||
if not isinstance(config[k], v):
|
||||
raise ValueError(
|
||||
|
||||
Reference in New Issue
Block a user