Java call Python actor method use actor.call (#7614)

This commit is contained in:
fyrestone
2020-03-17 14:52:43 +08:00
committed by GitHub
parent ffa9df4683
commit 7697ea2be2
10 changed files with 127 additions and 46 deletions
@@ -0,0 +1,41 @@
// Generated by `RayCallGenerator.java`. DO NOT EDIT.
package org.ray.api;
/**
* This class provides type-safe interfaces for remote actor calls.
**/
@SuppressWarnings({"rawtypes", "unchecked"})
interface PyActorCall {
default RayObject call(String functionName) {
Object[] args = new Object[]{};
return Ray.internal().callPyActor((RayPyActor)this, functionName, args);
}
default RayObject call(String functionName, Object obj0) {
Object[] args = new Object[]{obj0};
return Ray.internal().callPyActor((RayPyActor)this, functionName, args);
}
default RayObject call(String functionName, Object obj0, Object obj1) {
Object[] args = new Object[]{obj0, obj1};
return Ray.internal().callPyActor((RayPyActor)this, functionName, args);
}
default RayObject call(String functionName, Object obj0, Object obj1, Object obj2) {
Object[] args = new Object[]{obj0, obj1, obj2};
return Ray.internal().callPyActor((RayPyActor)this, functionName, args);
}
default RayObject call(String functionName, Object obj0, Object obj1, Object obj2, Object obj3) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
return Ray.internal().callPyActor((RayPyActor)this, functionName, args);
}
default RayObject call(String functionName, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
return Ray.internal().callPyActor((RayPyActor)this, functionName, args);
}
}
+28 -24
View File
@@ -3847,136 +3847,140 @@ class RayCall {
Object[] args = new Object[]{};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, CallOptions options) {
Object[] args = new Object[]{};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0) {
Object[] args = new Object[]{obj0};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, CallOptions options) {
Object[] args = new Object[]{obj0};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1) {
Object[] args = new Object[]{obj0, obj1};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, CallOptions options) {
Object[] args = new Object[]{obj0, obj1};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2) {
Object[] args = new Object[]{obj0, obj1, obj2};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, CallOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, Object obj3) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, Object obj3, CallOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4, CallOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4, Object obj5) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4, obj5};
return Ray.internal().callPy(moduleName, functionName, args, null);
}
public static RayObject callPy(String moduleName, String functionName, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4, Object obj5, CallOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4, obj5};
return Ray.internal().callPy(moduleName, functionName, args, options);
}
public static RayObject callPy(RayPyActor pyActor, String functionName) {
Object[] args = new Object[]{};
return Ray.internal().callPy(pyActor, functionName, args);
}
public static RayObject callPy(RayPyActor pyActor, String functionName, Object obj0) {
Object[] args = new Object[]{obj0};
return Ray.internal().callPy(pyActor, functionName, args);
}
public static RayObject callPy(RayPyActor pyActor, String functionName, Object obj0, Object obj1) {
Object[] args = new Object[]{obj0, obj1};
return Ray.internal().callPy(pyActor, functionName, args);
}
public static RayObject callPy(RayPyActor pyActor, String functionName, Object obj0, Object obj1, Object obj2) {
Object[] args = new Object[]{obj0, obj1, obj2};
return Ray.internal().callPy(pyActor, functionName, args);
}
public static RayObject callPy(RayPyActor pyActor, String functionName, Object obj0, Object obj1, Object obj2, Object obj3) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
return Ray.internal().callPy(pyActor, functionName, args);
}
public static RayObject callPy(RayPyActor pyActor, String functionName, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
return Ray.internal().callPy(pyActor, functionName, args);
}
public static RayPyActor createPyActor(String moduleName, String className) {
Object[] args = new Object[]{};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, ActorCreationOptions options) {
Object[] args = new Object[]{};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0) {
Object[] args = new Object[]{obj0};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, ActorCreationOptions options) {
Object[] args = new Object[]{obj0};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1) {
Object[] args = new Object[]{obj0, obj1};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, ActorCreationOptions options) {
Object[] args = new Object[]{obj0, obj1};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2) {
Object[] args = new Object[]{obj0, obj1, obj2};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, ActorCreationOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, Object obj3) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, Object obj3, ActorCreationOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4, ActorCreationOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4, Object obj5) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4, obj5};
return Ray.internal().createPyActor(moduleName, className, args, null);
}
public static RayPyActor createPyActor(String moduleName, String className, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4, Object obj5, ActorCreationOptions options) {
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4, obj5};
return Ray.internal().createPyActor(moduleName, className, args, options);
}
}
@@ -3,7 +3,7 @@ package org.ray.api;
/**
* Handle of a Python actor.
*/
public interface RayPyActor extends RayActor {
public interface RayPyActor extends RayActor, PyActorCall {
/**
* @return Module name of the Python actor class.
@@ -137,7 +137,7 @@ public interface RayRuntime {
* @param args Arguments of the function.
* @return The result object.
*/
RayObject callPy(RayPyActor pyActor, String functionName, Object[] args);
RayObject callPyActor(RayPyActor pyActor, String functionName, Object[] args);
/**
* Create a Python actor on a remote node.