mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 19:32:11 +08:00
[Java] fix java test (#9079)
This commit is contained in:
@@ -149,7 +149,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
Ray::getRuntimeContext,
|
||||
() -> Ray.task(MultiThreadingTest::echo, 1).remote(),
|
||||
() -> Ray.actor(Echo::new).remote(),
|
||||
() -> fooActor.task(Echo::echo, 1),
|
||||
() -> fooActor.task(Echo::echo, 1).remote(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,32 +13,32 @@ def py_return_input(v):
|
||||
def py_func_call_java_function():
|
||||
try:
|
||||
# None
|
||||
r = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
r = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"returnInput").remote(None)
|
||||
assert ray.get(r) is None
|
||||
# bool
|
||||
r = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
r = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"returnInputBoolean").remote(True)
|
||||
assert ray.get(r) is True
|
||||
# int
|
||||
r = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
r = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"returnInputInt").remote(100)
|
||||
assert ray.get(r) == 100
|
||||
# double
|
||||
r = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
r = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"returnInputDouble").remote(1.23)
|
||||
assert ray.get(r) == 1.23
|
||||
# string
|
||||
r = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
r = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"returnInputString").remote("Hello World!")
|
||||
assert ray.get(r) == "Hello World!"
|
||||
# list (tuple will be packed by pickle,
|
||||
# so only list can be transferred across language)
|
||||
r = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
r = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"returnInputIntArray").remote([1, 2, 3])
|
||||
assert ray.get(r) == [1, 2, 3]
|
||||
# pack
|
||||
f = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
f = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"pack")
|
||||
input = [100, "hello", 1.23, [1, "2", 3.0]]
|
||||
r = f.remote(*input)
|
||||
@@ -52,7 +52,7 @@ def py_func_call_java_function():
|
||||
def py_func_call_java_actor(value):
|
||||
assert isinstance(value, bytes)
|
||||
c = ray.java_actor_class(
|
||||
"io.ray.api.test.CrossLanguageInvocationTest$TestActor")
|
||||
"io.ray.test.CrossLanguageInvocationTest$TestActor")
|
||||
java_actor = c.remote(b"Counter")
|
||||
r = java_actor.concat.remote(value)
|
||||
return ray.get(r)
|
||||
@@ -77,7 +77,7 @@ def py_func_call_python_actor_from_handle(value):
|
||||
@ray.remote
|
||||
def py_func_pass_python_actor_handle():
|
||||
counter = Counter.remote(2)
|
||||
f = ray.java_function("io.ray.api.test.CrossLanguageInvocationTest",
|
||||
f = ray.java_function("io.ray.test.CrossLanguageInvocationTest",
|
||||
"callPythonActorHandle")
|
||||
r = f.remote(counter._serialization_helper()[0])
|
||||
return ray.get(r)
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@
|
||||
<suite name="RAY suite" verbose="2">
|
||||
<test name = "RAY test">
|
||||
<packages>
|
||||
<package name = "io.ray.api.test.*" />
|
||||
<package name = "io.ray.runtime.*" />
|
||||
<package name = "io.ray.test.*" />
|
||||
</packages>
|
||||
</test>
|
||||
<listeners>
|
||||
|
||||
Reference in New Issue
Block a user