mirror of
https://github.com/wassname/ray.git
synced 2026-07-09 11:43:56 +08:00
Cross-language invocation Part 1: Java calling Python functions and actors (#4166)
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user