From 5188b1d080071ef1bf71f0f683fbedf39a6d4dff Mon Sep 17 00:00:00 2001 From: Richard Liaw Date: Thu, 12 Jul 2018 19:18:47 +0200 Subject: [PATCH] [autoscaler] Bug for file mounts for tilde (#2382) --- python/ray/autoscaler/autoscaler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ray/autoscaler/autoscaler.py b/python/ray/autoscaler/autoscaler.py index e56dc36fc..6fac1a05a 100644 --- a/python/ray/autoscaler/autoscaler.py +++ b/python/ray/autoscaler/autoscaler.py @@ -640,6 +640,7 @@ def hash_runtime_conf(file_mounts, extra_objs): hasher = hashlib.sha1() def add_content_hashes(path): + path = os.path.expanduser(path) if os.path.isdir(path): dirs = [] for dirpath, _, filenames in os.walk(path): @@ -651,7 +652,7 @@ def hash_runtime_conf(file_mounts, extra_objs): with open(os.path.join(dirpath, name), "rb") as f: hasher.update(binascii.hexlify(f.read())) else: - with open(os.path.expanduser(path), "rb") as f: + with open(path, "rb") as f: hasher.update(binascii.hexlify(f.read())) hasher.update(json.dumps(sorted(file_mounts.items())).encode("utf-8"))