mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 03:34:48 +08:00
[Java] Refine python function (#8943)
This commit is contained in:
@@ -11,7 +11,7 @@ import io.ray.api.WaitResult;
|
||||
import io.ray.api.exception.RayException;
|
||||
import io.ray.api.function.PyActorClass;
|
||||
import io.ray.api.function.PyActorMethod;
|
||||
import io.ray.api.function.PyRemoteFunction;
|
||||
import io.ray.api.function.PyFunction;
|
||||
import io.ray.api.function.RayFunc;
|
||||
import io.ray.api.id.ObjectId;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
@@ -107,15 +107,14 @@ public abstract class AbstractRayRuntime implements RayRuntimeInternal {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectRef call(PyRemoteFunction pyRemoteFunction, Object[] args,
|
||||
CallOptions options) {
|
||||
public ObjectRef call(PyFunction pyFunction, Object[] args, CallOptions options) {
|
||||
PyFunctionDescriptor functionDescriptor = new PyFunctionDescriptor(
|
||||
pyRemoteFunction.moduleName,
|
||||
pyFunction.moduleName,
|
||||
"",
|
||||
pyRemoteFunction.functionName);
|
||||
pyFunction.functionName);
|
||||
// Python functions always have a return value, even if it's `None`.
|
||||
return callNormalFunction(functionDescriptor, args,
|
||||
/*returnType=*/Optional.of(pyRemoteFunction.returnType), options);
|
||||
/*returnType=*/Optional.of(pyFunction.returnType), options);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
newLine("import io.ray.api.call.TaskCaller;");
|
||||
newLine("import io.ray.api.call.VoidTaskCaller;");
|
||||
newLine("import io.ray.api.function.PyActorClass;");
|
||||
newLine("import io.ray.api.function.PyRemoteFunction;");
|
||||
newLine("import io.ray.api.function.PyFunction;");
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
newLine("import io.ray.api.function.RayFunc" + i + ";");
|
||||
}
|
||||
@@ -273,8 +273,8 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
paramPrefix += "PyActorMethod<R> pyActorMethod";
|
||||
funcArgs += "pyActorMethod";
|
||||
} else {
|
||||
paramPrefix += "PyRemoteFunction<R> pyRemoteFunction";
|
||||
funcArgs += "pyRemoteFunction";
|
||||
paramPrefix += "PyFunction<R> pyFunction";
|
||||
funcArgs += "pyFunction";
|
||||
}
|
||||
if (numParameters > 0) {
|
||||
paramPrefix += ", ";
|
||||
|
||||
Reference in New Issue
Block a user