[xlang] Cross language Python support (#6709)

This commit is contained in:
fyrestone
2020-02-08 13:01:28 +08:00
committed by GitHub
parent f146d05b36
commit 0648bd28ef
59 changed files with 1412 additions and 580 deletions
@@ -12,6 +12,25 @@ def py_func(value):
return b"Response from Python: " + value
@ray.remote
def py_func_call_java_function(value):
assert isinstance(value, bytes)
f = ray.java_function("org.ray.api.test.CrossLanguageInvocationTest",
"bytesEcho")
r = f.remote(value)
return b"[Python]py_func -> " + ray.get(r)
@ray.remote
def py_func_call_java_actor(value):
assert isinstance(value, bytes)
c = ray.java_actor_class(
"org.ray.api.test.CrossLanguageInvocationTest$TestActor")
java_actor = c.remote(b"Counter")
r = java_actor.concat.remote(value)
return ray.get(r)
@ray.remote
class Counter(object):
def __init__(self, value):