Refactor code about ray.ObjectID. (#3674)

* Refactor code about ray.ObjectID.

* remove from_random and use nil_id instead of constructor

* remove id() in hash

* Lint and fix

* Change driver id to ObjectID

* Replace binary_to_hex(ObjectID.id()) to ObjectID.hex()
This commit is contained in:
Yuhong Guo
2019-01-13 01:47:29 -08:00
committed by Philipp Moritz
parent c4b058739b
commit d2cf8561f2
14 changed files with 191 additions and 169 deletions
+6 -3
View File
@@ -12,10 +12,11 @@ import threading
import time
import ray.ray_constants as ray_constants
import ray.test.cluster_utils
from ray.utils import _random_string
import pytest
from ray.test.cluster_utils import Cluster
def relevant_errors(error_type):
return [info for info in ray.error_info() if info["type"] == error_type]
@@ -620,7 +621,7 @@ def test_warning_for_too_many_nested_tasks(shutdown_only):
@pytest.fixture
def ray_start_two_nodes():
# Start the Ray processes.
cluster = ray.test.cluster_utils.Cluster()
cluster = Cluster()
for _ in range(2):
cluster.add_node(
num_cpus=0,
@@ -674,6 +675,8 @@ def test_raylet_crash_when_get(ray_start_regular):
thread = threading.Thread(target=sleep_to_kill_raylet)
thread.start()
with pytest.raises(Exception, match=r".*raylet client may be closed.*"):
with pytest.raises(
ray.raylet.RayCommonError,
match=r".*raylet client may be closed.*"):
ray.get(nonexistent_id)
thread.join()