mirror of
https://github.com/wassname/ray.git
synced 2026-07-03 06:02:48 +08:00
[xlang] Cross language serialize ActorHandle (#7134)
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user