diff --git a/python/ray/local_scheduler/local_scheduler_services.py b/python/ray/local_scheduler/local_scheduler_services.py index 6fa1cd160..b20e560eb 100644 --- a/python/ray/local_scheduler/local_scheduler_services.py +++ b/python/ray/local_scheduler/local_scheduler_services.py @@ -5,6 +5,7 @@ from __future__ import print_function import os import random import subprocess +import sys import time @@ -81,13 +82,14 @@ def start_local_scheduler(plasma_store_name, assert plasma_store_name is not None assert plasma_manager_name is not None assert redis_address is not None - start_worker_command = ("python {} " + start_worker_command = ("{} {} " "--node-ip-address={} " "--object-store-name={} " "--object-store-manager-name={} " "--local-scheduler-name={} " "--redis-address={}" - .format(worker_path, + .format(sys.executable, + worker_path, node_ip_address, plasma_store_name, plasma_manager_name, diff --git a/python/ray/services.py b/python/ray/services.py index a37c16a30..4076ebfb4 100644 --- a/python/ray/services.py +++ b/python/ray/services.py @@ -412,7 +412,7 @@ def start_log_monitor(redis_address, node_ip_address, stdout_file=None, log_monitor_filepath = os.path.join( os.path.dirname(os.path.abspath(__file__)), "log_monitor.py") - p = subprocess.Popen(["python", log_monitor_filepath, + p = subprocess.Popen([sys.executable, log_monitor_filepath, "--redis-address", redis_address, "--node-ip-address", node_ip_address], stdout=stdout_file, stderr=stderr_file) @@ -686,7 +686,7 @@ def start_worker(node_ip_address, object_store_name, object_store_manager_name, Python process that imported services exits. This is True by default. """ - command = ["python", + command = [sys.executable, worker_path, "--node-ip-address=" + node_ip_address, "--object-store-name=" + object_store_name, @@ -719,7 +719,7 @@ def start_monitor(redis_address, node_ip_address, stdout_file=None, """ monitor_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "monitor.py") - command = ["python", + command = [sys.executable, monitor_path, "--redis-address=" + str(redis_address)] p = subprocess.Popen(command, stdout=stdout_file, stderr=stderr_file) diff --git a/test/multi_node_test.py b/test/multi_node_test.py index 0abe0e738..952e08da0 100644 --- a/test/multi_node_test.py +++ b/test/multi_node_test.py @@ -5,6 +5,7 @@ from __future__ import print_function import unittest import ray import subprocess +import sys import tempfile import time @@ -89,7 +90,8 @@ print("success") with tempfile.NamedTemporaryFile() as f: f.write(driver_script.encode("ascii")) f.flush() - out = subprocess.check_output(["python", f.name]).decode("ascii") + out = subprocess.check_output([sys.executable, + f.name]).decode("ascii") # Make sure the other driver succeeded. self.assertIn("success", out) @@ -129,7 +131,8 @@ print("success") with tempfile.NamedTemporaryFile() as f: f.write(driver_script.encode("ascii")) f.flush() - out = subprocess.check_output(["python", f.name]).decode("ascii") + out = subprocess.check_output([sys.executable, + f.name]).decode("ascii") @ray.remote def f():