From ac9610b19def11c9a276cfbc474793697198f238 Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Sun, 15 Nov 2020 11:49:50 -0800 Subject: [PATCH] [Autoscaler] Precisely match docker HOME (#12020) * [Autoscaler] Precisely match docker HOME The current grep will match any env variable keyed by HOME. This will include some unwanted variables like PYTHONHOME, PROJECT_HOME, etc. Depending on the order of the environment variable, the subsequent docker setup command might fail. * fstring --- python/ray/autoscaler/_private/command_runner.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/ray/autoscaler/_private/command_runner.py b/python/ray/autoscaler/_private/command_runner.py index d37d16382..3b3692a2c 100644 --- a/python/ray/autoscaler/_private/command_runner.py +++ b/python/ray/autoscaler/_private/command_runner.py @@ -669,8 +669,7 @@ class DockerCommandRunner(CommandRunnerInterface): if user_pos > -1: if self.home_dir is None: self.home_dir = self.ssh_command_runner.run( - "docker exec {} env | grep HOME | cut -d'=' -f2".format( - self.container_name), + f"docker exec {self.container_name} printenv HOME", with_output=True).decode("utf-8").strip() if any_char: