mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
Use new task spec for computing IDs in raylet code path. (#1830)
* Use new task spec for computing IDs in raylet code path. * Fix linting. * Fixes * Fix test.
This commit is contained in:
committed by
Stephanie Wang
parent
0b7ad668ff
commit
256389dc59
+14
-2
@@ -5,6 +5,8 @@ from __future__ import print_function
|
||||
import pytest
|
||||
import ray
|
||||
|
||||
test_values = [1, 1.0, "test", b"test", (0, 1), [0, 1], {0: 1}]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def ray_start():
|
||||
@@ -40,8 +42,7 @@ def test_basic_task_api(ray_start):
|
||||
def f_args_by_value(x):
|
||||
return x
|
||||
|
||||
args = [1, 1.0, "test", b"test", (0, 1), [0, 1], {0: 1}]
|
||||
for arg in args:
|
||||
for arg in test_values:
|
||||
assert ray.get(f_args_by_value.remote(arg)) == arg
|
||||
|
||||
# Test arguments passed by ID.
|
||||
@@ -49,6 +50,17 @@ def test_basic_task_api(ray_start):
|
||||
# Test keyword arguments.
|
||||
|
||||
|
||||
def test_put_api(ray_start):
|
||||
|
||||
for obj in test_values:
|
||||
assert ray.get(ray.put(obj)) == obj
|
||||
|
||||
# Test putting object IDs.
|
||||
x_id = ray.put(0)
|
||||
for obj in [[x_id], (x_id,), {x_id: x_id}]:
|
||||
assert ray.get(ray.put(obj)) == obj
|
||||
|
||||
|
||||
def test_actor_api(ray_start):
|
||||
|
||||
@ray.remote
|
||||
|
||||
Reference in New Issue
Block a user