[xlang] Cross language serialize ActorHandle (#7134)

This commit is contained in:
fyrestone
2020-02-17 20:44:56 +08:00
committed by GitHub
parent b079787c59
commit a6b8bd47b0
27 changed files with 498 additions and 197 deletions
@@ -31,6 +31,31 @@ def py_func_call_java_actor(value):
return ray.get(r)
@ray.remote
def py_func_call_java_actor_from_handle(value):
assert isinstance(value, bytes)
actor_handle = ray.actor.ActorHandle._deserialization_helper(value, False)
r = actor_handle.concat.remote(b"2")
return ray.get(r)
@ray.remote
def py_func_call_python_actor_from_handle(value):
assert isinstance(value, bytes)
actor_handle = ray.actor.ActorHandle._deserialization_helper(value, False)
r = actor_handle.increase.remote(2)
return ray.get(r)
@ray.remote
def py_func_pass_python_actor_handle():
counter = Counter.remote(2)
f = ray.java_function("org.ray.api.test.CrossLanguageInvocationTest",
"callPythonActorHandle")
r = f.remote(counter._serialization_helper(False))
return ray.get(r)
@ray.remote
class Counter(object):
def __init__(self, value):