diff --git a/python/ray/autoscaler/autoscaler.py b/python/ray/autoscaler/autoscaler.py index 13f97e0ea..95e4b0bf2 100644 --- a/python/ray/autoscaler/autoscaler.py +++ b/python/ray/autoscaler/autoscaler.py @@ -493,7 +493,8 @@ def with_head_node_ip(cmds): def hash_launch_conf(node_conf, auth): hasher = hashlib.sha1() - hasher.update(json.dumps([node_conf, auth]).encode("utf-8")) + hasher.update( + json.dumps([node_conf, auth], sort_keys=True).encode("utf-8")) return hasher.hexdigest() @@ -516,7 +517,7 @@ def hash_runtime_conf(file_mounts, extra_objs): hasher.update(f.read().encode("utf-8")) hasher.update(json.dumps(sorted(file_mounts.items())).encode("utf-8")) - hasher.update(json.dumps(extra_objs).encode("utf-8")) + hasher.update(json.dumps(extra_objs, sort_keys=True).encode("utf-8")) for local_path in sorted(file_mounts.values()): add_content_hashes(local_path) diff --git a/python/ray/autoscaler/commands.py b/python/ray/autoscaler/commands.py index 28aa59042..e283eb970 100644 --- a/python/ray/autoscaler/commands.py +++ b/python/ray/autoscaler/commands.py @@ -80,12 +80,13 @@ def get_or_create_head_node(config, no_restart): if not head_node: confirm("This will create a new cluster") elif not no_restart: - confirm("This will restart your cluster") + confirm("This will restart cluster services") launch_hash = hash_launch_conf(config["head_node"], config["auth"]) if head_node is None or provider.node_tags(head_node).get( TAG_RAY_LAUNCH_CONFIG) != launch_hash: if head_node is not None: + confirm("Head node config out-of-date. It will be terminated") print("Terminating outdated head node {}".format(head_node)) provider.terminate_node(head_node) print("Launching new head node...")