diff --git a/python/ray/node.py b/python/ray/node.py index 8fce783ac..fe1e505e5 100644 --- a/python/ray/node.py +++ b/python/ray/node.py @@ -472,7 +472,8 @@ class Node: This method helps to prepare a socket file. 1. Make the directory if the directory does not exist. - 2. If the socket file exists, raise exception. + 2. If the socket file exists, do nothing (this just means we aren't the + first worker on the node). Args: socket_path (string): the socket file to prepare. @@ -488,9 +489,6 @@ class Node: result = self._make_inc_temp( prefix=default_prefix, directory_name=self._sockets_dir) else: - if os.path.exists(socket_path): - raise RuntimeError( - "Socket file {} exists!".format(socket_path)) try_to_create_directory(os.path.dirname(socket_path)) # Check socket path length to make sure it's short enough diff --git a/python/ray/tests/test_advanced_3.py b/python/ray/tests/test_advanced_3.py index aae6bc4aa..fbab8c8c0 100644 --- a/python/ray/tests/test_advanced_3.py +++ b/python/ray/tests/test_advanced_3.py @@ -421,7 +421,14 @@ def test_socket_dir_not_existing(shutdown_only): "tests", random_name) temp_raylet_socket_name = os.path.join(temp_raylet_socket_dir, "raylet_socket") - ray.init(num_cpus=1, raylet_socket_name=temp_raylet_socket_name) + ray.init(num_cpus=2, raylet_socket_name=temp_raylet_socket_name) + + @ray.remote + def foo(x): + time.sleep(1) + return 2 * x + + ray.get([foo.remote(i) for i in range(2)]) def test_raylet_is_robust_to_random_messages(ray_start_regular):