Package io.ray.api.function
Class PyActorMethod<R>
java.lang.Object
io.ray.api.function.PyActorMethod<R>
A class that represents a method of a Python actor.
Note, information about the actor will be inferred from the actor handle, so it's not specified in this class.
there is a Python actor class A.
\@ray.remote
class A(object):
def foo(self):
return "Hello world!"
suppose we have got the Python actor class A's handle in Java
PyActorHandle actor = ...; // returned from Ray.createActor or passed from Python
then we can call the actor method:
// A.foo returns a string, so we have to set the returnType to String.class
ObjectRef<String> res = actor.call(PyActorMethod.of("foo", String.class));
String x = res.get();
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PyActorMethod<Object>Create a python actor method.static <R> PyActorMethod<R>Create a python actor method.
-
Field Details
-
methodName
-
returnType
-
-
Method Details
-
of
Create a python actor method.- Parameters:
methodName- The name of this actor method- Returns:
- a python actor method.
-
of
Create a python actor method.- Type Parameters:
R- The type of the return value of this actor method- Parameters:
methodName- The name of this actor methodreturnType- Class of the return value of this actor method- Returns:
- a python actor method.
-