Skip to content

Commit

Permalink
[autoscaler] Bad error message when dict field omitted (ray-project#1632
Browse files Browse the repository at this point in the history
)

* Wed Feb 28 23:22:55 PST 2018

* Wed Feb 28 23:24:07 PST 2018
  • Loading branch information
ericl committed Mar 4, 2018
1 parent 75293a0 commit 9b33f3a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/ray/autoscaler/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,13 @@ def debug_string(self, nodes=None):
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")
Expand All @@ -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(
Expand Down

0 comments on commit 9b33f3a

Please sign in to comment.