diff --git a/python/ray/autoscaler/command_runner.py b/python/ray/autoscaler/command_runner.py index 3df2ae4fb..b94a73683 100644 --- a/python/ray/autoscaler/command_runner.py +++ b/python/ray/autoscaler/command_runner.py @@ -220,6 +220,9 @@ class KubernetesCommandRunner(CommandRunnerInterface): cmd = _with_environment_variables(cmd, environment_variables) cmd = _with_interactive(cmd) final_cmd += cmd + # `kubectl exec` + subprocess w/ list of args has unexpected + # side-effects. + final_cmd = " ".join(final_cmd) logger.info(self.log_prefix + "Running {}".format(final_cmd)) try: if with_output: diff --git a/python/ray/tests/test_command_runner.py b/python/ray/tests/test_command_runner.py index fd7b32741..5a26aaa09 100644 --- a/python/ray/tests/test_command_runner.py +++ b/python/ray/tests/test_command_runner.py @@ -125,10 +125,7 @@ def test_kubernetes_command_runner(): """\'true && source ~/.bashrc && export OMP_NUM_THREADS=1 PYTHONWARNINGS=ignore && (export var1=\'"\'"\'"quote between this \\" and this"\'"\'"\';export var2=\'"\'"\'"123"\'"\'"\';echo helloo)\'""" # noqa: E501 ] - # Much easier to debug this loop than the function call. - for x, y in zip(process_runner.calls[0], expected): - assert x == y - process_runner.assert_has_call("1.2.3.4", exact=expected) + assert process_runner.calls[0] == " ".join(expected) def test_docker_command_runner():