public class PyActorMethod<R> extends Object
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();
| 限定符和类型 | 字段和说明 |
|---|---|
String |
methodName |
Class<R> |
returnType |
| 限定符和类型 | 方法和说明 |
|---|---|
static PyActorMethod<Object> |
of(String methodName)
Create a python actor method.
|
static <R> PyActorMethod<R> |
of(String methodName,
Class<R> returnType)
Create a python actor method.
|
public static PyActorMethod<Object> of(String methodName)
methodName - The name of this actor methodpublic static <R> PyActorMethod<R> of(String methodName, Class<R> returnType)
R - The type of the return value of this actor methodmethodName - The name of this actor methodreturnType - Class of the return value of this actor methodCopyright © 2022. All rights reserved.