Cross-language invocation Part 1: Java calling Python functions and actors (#4166)

This commit is contained in:
Hao Chen
2019-03-21 13:34:21 +08:00
committed by GitHub
parent 828dc08ac8
commit d03999d01e
28 changed files with 872 additions and 228 deletions
@@ -0,0 +1,20 @@
# This file is used by CrossLanguageInvocationTest.java to test cross-language
# invocation.
import ray
import six
@ray.remote
def py_func(value):
assert isinstance(value, bytes)
return b"Response from Python: " + value
@ray.remote
class Counter(object):
def __init__(self, value):
self.value = int(value)
def increase(self, delta):
self.value += int(delta)
return str(self.value).encode("utf-8") if six.PY3 else str(self.value)