mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 21:11:24 +08:00
Resolve dependencies locally before submitting direct actor tasks (#6191)
* Priority queue in direct actor transport by task number * Move LocalDependencyResolver out to separate file, share with direct actor transport * works * Test case for ordering * Cleanups * Remove priority queue * comment * Share ClientFactoryFn with direct actor transport * Unit test * fix
This commit is contained in:
@@ -1349,6 +1349,31 @@ def test_direct_actor_enabled(ray_start_regular):
|
||||
assert ray.get(obj_id) == 2
|
||||
|
||||
|
||||
def test_direct_actor_order(shutdown_only):
|
||||
ray.init(num_cpus=4)
|
||||
|
||||
@ray.remote
|
||||
def small_value():
|
||||
time.sleep(0.01 * np.random.randint(0, 10))
|
||||
return 0
|
||||
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
def __init__(self):
|
||||
self.count = 0
|
||||
|
||||
def inc(self, count, dependency):
|
||||
assert count == self.count
|
||||
self.count += 1
|
||||
return count
|
||||
|
||||
a = Actor._remote(is_direct_call=True)
|
||||
assert ray.get([
|
||||
a.inc.remote(i, small_value.options(is_direct_call=True).remote())
|
||||
for i in range(100)
|
||||
]) == list(range(100))
|
||||
|
||||
|
||||
def test_direct_actor_large_objects(ray_start_regular):
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
|
||||
Reference in New Issue
Block a user