mirror of
https://github.com/wassname/ray.git
synced 2026-07-15 11:25:40 +08:00
Improve code related to node (#4383)
* Make full use of node implement local node fix bugs mentioned in comments * Add more tests * Use more specific exception handling * fix, lint * fix for py2.x
This commit is contained in:
@@ -7,6 +7,13 @@ import shutil
|
||||
import time
|
||||
import pytest
|
||||
import ray
|
||||
from ray.tests.cluster_utils import Cluster
|
||||
|
||||
# Py2 compatibility
|
||||
try:
|
||||
FileNotFoundError
|
||||
except NameError:
|
||||
FileNotFoundError = OSError
|
||||
|
||||
|
||||
def test_conn_cluster():
|
||||
@@ -52,8 +59,17 @@ def test_raylet_socket_name():
|
||||
ray.shutdown()
|
||||
try:
|
||||
os.remove("/tmp/i_am_a_temp_socket")
|
||||
except Exception:
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
pass # It could have been removed by Ray.
|
||||
cluster = Cluster(True)
|
||||
cluster.add_node(raylet_socket_name="/tmp/i_am_a_temp_socket_2")
|
||||
assert os.path.exists(
|
||||
"/tmp/i_am_a_temp_socket_2"), "Specified socket path not found."
|
||||
cluster.shutdown()
|
||||
try:
|
||||
os.remove("/tmp/i_am_a_temp_socket_2")
|
||||
except FileNotFoundError:
|
||||
pass # It could have been removed by Ray.
|
||||
|
||||
|
||||
def test_temp_plasma_store_socket():
|
||||
@@ -63,8 +79,17 @@ def test_temp_plasma_store_socket():
|
||||
ray.shutdown()
|
||||
try:
|
||||
os.remove("/tmp/i_am_a_temp_socket")
|
||||
except Exception:
|
||||
pass
|
||||
except FileNotFoundError:
|
||||
pass # It could have been removed by Ray.
|
||||
cluster = Cluster(True)
|
||||
cluster.add_node(plasma_store_socket_name="/tmp/i_am_a_temp_socket_2")
|
||||
assert os.path.exists(
|
||||
"/tmp/i_am_a_temp_socket_2"), "Specified socket path not found."
|
||||
cluster.shutdown()
|
||||
try:
|
||||
os.remove("/tmp/i_am_a_temp_socket_2")
|
||||
except FileNotFoundError:
|
||||
pass # It could have been removed by Ray.
|
||||
|
||||
|
||||
def test_raylet_tempfiles():
|
||||
|
||||
Reference in New Issue
Block a user