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:
Stephanie Wang
2019-11-20 16:45:19 -08:00
committed by GitHub
parent 33c768ebe4
commit c0be9e6738
13 changed files with 429 additions and 247 deletions
+25
View File
@@ -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):