From 2d35a97a7628e2a7c1b4f313c690626c1d46c529 Mon Sep 17 00:00:00 2001 From: Kristian Hartikainen Date: Sat, 6 Oct 2018 00:34:53 -0700 Subject: [PATCH] Bug/log syncer fails with parentheses (#2653) * Update rsync command * Escape rsync locations * Fix the accidental variable move * Update rsync to use -s flag --- python/ray/tune/log_sync.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/ray/tune/log_sync.py b/python/ray/tune/log_sync.py index 2e18a8658..109c11a01 100644 --- a/python/ray/tune/log_sync.py +++ b/python/ray/tune/log_sync.py @@ -107,11 +107,13 @@ class _LogSyncer(object): if not distutils.spawn.find_executable("rsync"): logger.error("Log sync requires rsync to be installed.") return + source = '{}@{}:{}/'.format(ssh_user, self.worker_ip, + self.local_dir) + target = '{}/'.format(self.local_dir) worker_to_local_sync_cmd = (( - """rsync -avz -e "ssh -i {} -o ConnectTimeout=120s """ - """-o StrictHostKeyChecking=no" '{}@{}:{}/' '{}/'""").format( - quote(ssh_key), ssh_user, self.worker_ip, - quote(self.local_dir), quote(self.local_dir))) + """rsync -savz -e "ssh -i {} -o ConnectTimeout=120s """ + """-o StrictHostKeyChecking=no" {} {}""").format( + quote(ssh_key), quote(source), quote(target))) if self.remote_dir: if self.remote_dir.startswith(S3_PREFIX):