mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 19:32:11 +08:00
[Java] Refactor java api (#8858)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
package io.ray.api;
|
||||
|
||||
import io.ray.api.call.ActorTaskCaller;
|
||||
import io.ray.api.call.VoidActorTaskCaller;
|
||||
import io.ray.api.function.RayFunc1;
|
||||
import io.ray.api.function.RayFunc2;
|
||||
import io.ray.api.function.RayFunc3;
|
||||
@@ -18,637 +20,636 @@ import io.ray.api.function.RayFuncVoid6;
|
||||
/**
|
||||
* This class provides type-safe interfaces for remote actor calls.
|
||||
**/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
interface ActorCall<A> {
|
||||
|
||||
default <R> ObjectRef<R> call(RayFunc1<A, R> f) {
|
||||
default <R> ActorTaskCaller<R> task(RayFunc1<A, R> f) {
|
||||
Object[] args = new Object[]{};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default void call(RayFuncVoid1<A> f) {
|
||||
default VoidActorTaskCaller task(RayFuncVoid1<A> f) {
|
||||
Object[] args = new Object[]{};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, R> ObjectRef<R> call(RayFunc2<A, T0, R> f, T0 t0) {
|
||||
default <T0, R> ActorTaskCaller<R> task(RayFunc2<A, T0, R> f, T0 t0) {
|
||||
Object[] args = new Object[]{t0};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, R> ObjectRef<R> call(RayFunc2<A, T0, R> f, ObjectRef<T0> t0) {
|
||||
default <T0, R> ActorTaskCaller<R> task(RayFunc2<A, T0, R> f, ObjectRef<T0> t0) {
|
||||
Object[] args = new Object[]{t0};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0> void call(RayFuncVoid2<A, T0> f, T0 t0) {
|
||||
default <T0> VoidActorTaskCaller task(RayFuncVoid2<A, T0> f, T0 t0) {
|
||||
Object[] args = new Object[]{t0};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0> void call(RayFuncVoid2<A, T0> f, ObjectRef<T0> t0) {
|
||||
default <T0> VoidActorTaskCaller task(RayFuncVoid2<A, T0> f, ObjectRef<T0> t0) {
|
||||
Object[] args = new Object[]{t0};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, R> ObjectRef<R> call(RayFunc3<A, T0, T1, R> f, T0 t0, T1 t1) {
|
||||
default <T0, T1, R> ActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, T0 t0, T1 t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, R> ObjectRef<R> call(RayFunc3<A, T0, T1, R> f, T0 t0, ObjectRef<T1> t1) {
|
||||
default <T0, T1, R> ActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, T0 t0, ObjectRef<T1> t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, R> ObjectRef<R> call(RayFunc3<A, T0, T1, R> f, ObjectRef<T0> t0, T1 t1) {
|
||||
default <T0, T1, R> ActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, ObjectRef<T0> t0, T1 t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, R> ObjectRef<R> call(RayFunc3<A, T0, T1, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
|
||||
default <T0, T1, R> ActorTaskCaller<R> task(RayFunc3<A, T0, T1, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, T0 t0, T1 t1) {
|
||||
default <T0, T1> VoidActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, T0 t0, T1 t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, T0 t0, ObjectRef<T1> t1) {
|
||||
default <T0, T1> VoidActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, T0 t0, ObjectRef<T1> t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, ObjectRef<T0> t0, T1 t1) {
|
||||
default <T0, T1> VoidActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, ObjectRef<T0> t0, T1 t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
|
||||
default <T0, T1> VoidActorTaskCaller task(RayFuncVoid3<A, T0, T1> f, ObjectRef<T0> t0, ObjectRef<T1> t1) {
|
||||
Object[] args = new Object[]{t0, t1};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, T2 t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, R> ObjectRef<R> call(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2, R> ActorTaskCaller<R> task(RayFunc4<A, T0, T1, T2, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, T2 t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, ObjectRef<T1> t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, T1 t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
default <T0, T1, T2> VoidActorTaskCaller task(RayFuncVoid4<A, T0, T1, T2> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2) {
|
||||
Object[] args = new Object[]{t0, t1, t2};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, R> ObjectRef<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3, R> ActorTaskCaller<R> task(RayFunc5<A, T0, T1, T2, T3, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
default <T0, T1, T2, T3> VoidActorTaskCaller task(RayFuncVoid5<A, T0, T1, T2, T3> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4, R> ObjectRef<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4, R> ActorTaskCaller<R> task(RayFunc6<A, T0, T1, T2, T3, T4, R> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
return Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new ActorTaskCaller<>((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, T1 t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, T2 t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, T3 t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, T4 t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
default <T0, T1, T2, T3, T4> VoidActorTaskCaller task(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, ObjectRef<T0> t0, ObjectRef<T1> t1, ObjectRef<T2> t2, ObjectRef<T3> t3, ObjectRef<T4> t4) {
|
||||
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||
Ray.internal().callActor((ActorHandle) this, f, args);
|
||||
return new VoidActorTaskCaller((ActorHandle) this, f, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,42 +2,42 @@
|
||||
|
||||
package io.ray.api;
|
||||
|
||||
import io.ray.api.call.PyActorTaskCaller;
|
||||
import io.ray.api.function.PyActorMethod;
|
||||
|
||||
/**
|
||||
* This class provides type-safe interfaces for remote actor calls.
|
||||
**/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
interface PyActorCall {
|
||||
|
||||
default <R> ObjectRef<R> call(PyActorMethod<R> pyActorMethod) {
|
||||
default <R> PyActorTaskCaller<R> task(PyActorMethod<R> pyActorMethod) {
|
||||
Object[] args = new Object[]{};
|
||||
return Ray.internal().callActor((PyActorHandle)this, pyActorMethod, args);
|
||||
return new PyActorTaskCaller<>((PyActorHandle)this, pyActorMethod, args);
|
||||
}
|
||||
|
||||
default <R> ObjectRef<R> call(PyActorMethod<R> pyActorMethod, Object obj0) {
|
||||
default <R> PyActorTaskCaller<R> task(PyActorMethod<R> pyActorMethod, Object obj0) {
|
||||
Object[] args = new Object[]{obj0};
|
||||
return Ray.internal().callActor((PyActorHandle)this, pyActorMethod, args);
|
||||
return new PyActorTaskCaller<>((PyActorHandle)this, pyActorMethod, args);
|
||||
}
|
||||
|
||||
default <R> ObjectRef<R> call(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1) {
|
||||
default <R> PyActorTaskCaller<R> task(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1) {
|
||||
Object[] args = new Object[]{obj0, obj1};
|
||||
return Ray.internal().callActor((PyActorHandle)this, pyActorMethod, args);
|
||||
return new PyActorTaskCaller<>((PyActorHandle)this, pyActorMethod, args);
|
||||
}
|
||||
|
||||
default <R> ObjectRef<R> call(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1, Object obj2) {
|
||||
default <R> PyActorTaskCaller<R> task(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1, Object obj2) {
|
||||
Object[] args = new Object[]{obj0, obj1, obj2};
|
||||
return Ray.internal().callActor((PyActorHandle)this, pyActorMethod, args);
|
||||
return new PyActorTaskCaller<>((PyActorHandle)this, pyActorMethod, args);
|
||||
}
|
||||
|
||||
default <R> ObjectRef<R> call(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1, Object obj2, Object obj3) {
|
||||
default <R> PyActorTaskCaller<R> task(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1, Object obj2, Object obj3) {
|
||||
Object[] args = new Object[]{obj0, obj1, obj2, obj3};
|
||||
return Ray.internal().callActor((PyActorHandle)this, pyActorMethod, args);
|
||||
return new PyActorTaskCaller<>((PyActorHandle)this, pyActorMethod, args);
|
||||
}
|
||||
|
||||
default <R> ObjectRef<R> call(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4) {
|
||||
default <R> PyActorTaskCaller<R> task(PyActorMethod<R> pyActorMethod, Object obj0, Object obj1, Object obj2, Object obj3, Object obj4) {
|
||||
Object[] args = new Object[]{obj0, obj1, obj2, obj3, obj4};
|
||||
return Ray.internal().callActor((PyActorHandle)this, pyActorMethod, args);
|
||||
return new PyActorTaskCaller<>((PyActorHandle)this, pyActorMethod, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.RayFuncR;
|
||||
|
||||
/**
|
||||
* A helper to create java actor.
|
||||
*
|
||||
* @param <A> The type of the concrete actor class.
|
||||
*/
|
||||
public class ActorCreator<A> extends BaseActorCreator<ActorCreator<A>> {
|
||||
private final RayFuncR<A> func;
|
||||
private final Object[] args;
|
||||
|
||||
public ActorCreator(RayFuncR<A> func, Object[] args) {
|
||||
this.func = func;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see io.ray.api.options.ActorCreationOptions.Builder#setJvmOptions(java.lang.String)
|
||||
*/
|
||||
public ActorCreator<A> setJvmOptions(String jvmOptions) {
|
||||
builder.setJvmOptions(jvmOptions);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a java actor remotely and return a handle to the created actor.
|
||||
*
|
||||
* @return a handle to the created java actor.
|
||||
*/
|
||||
public ActorHandle<A> remote() {
|
||||
return Ray.internal().createActor(func, args, buildOptions());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.RayFuncR;
|
||||
|
||||
/**
|
||||
* A helper to call java actor method.
|
||||
*
|
||||
* @param <R> The type of the java actor method return value
|
||||
*/
|
||||
public class ActorTaskCaller<R> {
|
||||
private final ActorHandle actor;
|
||||
private final RayFuncR<R> func;
|
||||
private final Object[] args;
|
||||
|
||||
public ActorTaskCaller(ActorHandle actor, RayFuncR<R> func, Object[] args) {
|
||||
this.actor = actor;
|
||||
this.func = func;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute an java actor method remotely and return an object reference to the result object in
|
||||
* the object store.
|
||||
*
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
return Ray.internal().callActor(actor, func, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Base helper to create actor.
|
||||
*
|
||||
* @param <T> The type of the concrete actor creator
|
||||
*/
|
||||
public class BaseActorCreator<T extends BaseActorCreator> {
|
||||
protected ActorCreationOptions.Builder builder = new ActorCreationOptions.Builder();
|
||||
|
||||
/**
|
||||
* Set a custom resource requirement to reserve for the lifetime of this actor.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param resourceName resource name
|
||||
* @param resourceQuantity resource quantity
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setResource(java.lang.String, java.lang.Double)
|
||||
*/
|
||||
public T setResource(String resourceName, Double resourceQuantity) {
|
||||
builder.setResource(resourceName, resourceQuantity);
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom resource requirements to reserve for the lifetime of this actor.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
* @see BaseActorCreator#setResources(java.util.Map)
|
||||
*/
|
||||
public T setResources(Map<String, Double> resources) {
|
||||
builder.setResources(resources);
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* This specifies the maximum number of times that the actor should be restarted when it dies
|
||||
* unexpectedly. The minimum valid value is 0 (default), which indicates that the actor doesn't
|
||||
* need to be restarted. A value of -1 indicates that an actor should be restarted indefinitely.
|
||||
*
|
||||
* @param maxRestarts max number of actor restarts
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setMaxRestarts(int)
|
||||
*/
|
||||
public T setMaxRestarts(int maxRestarts) {
|
||||
builder.setMaxRestarts(maxRestarts);
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the max number of concurrent calls to allow for this actor.
|
||||
*
|
||||
* The max concurrency defaults to 1 for threaded execution.
|
||||
* Note that the execution order is not guaranteed when max_concurrency > 1.
|
||||
*
|
||||
* @param maxConcurrency The max number of concurrent calls to allow for this actor.
|
||||
* @return self
|
||||
* @see ActorCreationOptions.Builder#setMaxConcurrency(int)
|
||||
*/
|
||||
public T setMaxConcurrency(int maxConcurrency) {
|
||||
builder.setMaxConcurrency(maxConcurrency);
|
||||
return self();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T self() {
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
protected ActorCreationOptions buildOptions() {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.options.CallOptions;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Base helper to call remote function.
|
||||
*
|
||||
* @param <T> The type of the concrete task caller
|
||||
*/
|
||||
public class BaseTaskCaller<T extends BaseTaskCaller<T>> {
|
||||
private CallOptions.Builder builder = new CallOptions.Builder();
|
||||
|
||||
/**
|
||||
* Set a custom resource requirement for resource {@code name}.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param name resource name
|
||||
* @param value resource capacity
|
||||
* @return self
|
||||
* @see CallOptions.Builder#setResource(java.lang.String, java.lang.Double)
|
||||
*/
|
||||
public T setResource(String name, Double value) {
|
||||
builder.setResource(name, value);
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom requirements for multiple resources.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
* @see CallOptions.Builder#setResources(java.util.Map)
|
||||
*/
|
||||
public T setResources(Map<String, Double> resources) {
|
||||
builder.setResources(resources);
|
||||
return self();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T self() {
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
protected CallOptions buildOptions() {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.PyActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.PyActorClass;
|
||||
|
||||
/**
|
||||
* A helper to create python actor.
|
||||
*/
|
||||
public class PyActorCreator extends BaseActorCreator<PyActorCreator> {
|
||||
private final PyActorClass pyActorClass;
|
||||
private final Object[] args;
|
||||
|
||||
public PyActorCreator(PyActorClass pyActorClass, Object[] args) {
|
||||
this.pyActorClass = pyActorClass;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a python actor remotely and return a handle to the created actor.
|
||||
*
|
||||
* @return a handle to the created python actor.
|
||||
*/
|
||||
public PyActorHandle remote() {
|
||||
return Ray.internal().createActor(pyActorClass, args, buildOptions());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.PyActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.PyActorMethod;
|
||||
|
||||
/**
|
||||
* A helper to call python actor method.
|
||||
*
|
||||
* @param <R> The type of the python actor method return value
|
||||
*/
|
||||
public class PyActorTaskCaller<R> {
|
||||
private final PyActorHandle actor;
|
||||
private final PyActorMethod<R> method;
|
||||
private final Object[] args;
|
||||
|
||||
public PyActorTaskCaller(PyActorHandle actor, PyActorMethod<R> method, Object[] args) {
|
||||
this.actor = actor;
|
||||
this.method = method;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a python actor method remotely and return an object reference to the result object in
|
||||
* the object store.
|
||||
*
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
return Ray.internal().callActor(actor, method, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.PyRemoteFunction;
|
||||
|
||||
/**
|
||||
* A helper to call python remote function.
|
||||
*
|
||||
* @param <R> The type of the python function return value
|
||||
*/
|
||||
public class PyTaskCaller<R> extends BaseTaskCaller<PyTaskCaller<R>> {
|
||||
private final PyRemoteFunction<R> func;
|
||||
private final Object[] args;
|
||||
|
||||
public PyTaskCaller(PyRemoteFunction<R> func, Object[] args) {
|
||||
this.func = func;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a python function remotely and return an object reference to the result object in the
|
||||
* object store.
|
||||
*
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
return Ray.internal().call(func, args, buildOptions());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.RayFuncR;
|
||||
|
||||
/**
|
||||
* A helper to call java remote function.
|
||||
*
|
||||
* @param <R> The type of the java remote function return value
|
||||
*/
|
||||
public class TaskCaller<R> extends BaseTaskCaller<TaskCaller<R>> {
|
||||
private final RayFuncR<R> func;
|
||||
private final Object[] args;
|
||||
|
||||
public TaskCaller(RayFuncR<R> func, Object[] args) {
|
||||
this.func = func;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a java function remotely and return an object reference to the result object in the
|
||||
* object store.
|
||||
*
|
||||
* @return an object reference to an object in the object store.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ObjectRef<R> remote() {
|
||||
return Ray.internal().call(func, args, buildOptions());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.RayFuncVoid;
|
||||
|
||||
/**
|
||||
* A helper to call java actor method which doesn't have a return value.
|
||||
*/
|
||||
public class VoidActorTaskCaller {
|
||||
private final ActorHandle actor;
|
||||
private final RayFuncVoid func;
|
||||
private final Object[] args;
|
||||
|
||||
public VoidActorTaskCaller(ActorHandle actor, RayFuncVoid func, Object[] args) {
|
||||
this.actor = actor;
|
||||
this.func = func;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a function remotely.
|
||||
*/
|
||||
public void remote() {
|
||||
Ray.internal().callActor(actor, func, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package io.ray.api.call;
|
||||
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.function.RayFuncVoid;
|
||||
|
||||
/**
|
||||
* A helper to call java remote function which doesn't have a return value.
|
||||
*/
|
||||
public class VoidTaskCaller extends BaseTaskCaller<VoidTaskCaller> {
|
||||
private final RayFuncVoid func;
|
||||
private final Object[] args;
|
||||
|
||||
public VoidTaskCaller(RayFuncVoid func, Object[] args) {
|
||||
this.func = func;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a function remotely.
|
||||
*/
|
||||
public void remote() {
|
||||
Ray.internal().call(func, args, buildOptions());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,7 @@ package io.ray.api.function;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Interface of all Ray remote functions.
|
||||
* Base interface of all Ray remote java functions.
|
||||
*/
|
||||
public interface RayFunc extends Serializable {
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 0 parameter.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc0<R> extends RayFunc {
|
||||
public interface RayFunc0<R> extends RayFuncR<R> {
|
||||
|
||||
R apply() throws Exception;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 1 parameter.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc1<T0, R> extends RayFunc {
|
||||
public interface RayFunc1<T0, R> extends RayFuncR<R> {
|
||||
|
||||
R apply(T0 t0) throws Exception;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 2 parameters.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc2<T0, T1, R> extends RayFunc {
|
||||
public interface RayFunc2<T0, T1, R> extends RayFuncR<R> {
|
||||
|
||||
R apply(T0 t0, T1 t1) throws Exception;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 3 parameters.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc3<T0, T1, T2, R> extends RayFunc {
|
||||
public interface RayFunc3<T0, T1, T2, R> extends RayFuncR<R> {
|
||||
|
||||
R apply(T0 t0, T1 t1, T2 t2) throws Exception;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 4 parameters.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc4<T0, T1, T2, T3, R> extends RayFunc {
|
||||
public interface RayFunc4<T0, T1, T2, T3, R> extends RayFuncR<R> {
|
||||
|
||||
R apply(T0 t0, T1 t1, T2 t2, T3 t3) throws Exception;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 5 parameters.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc5<T0, T1, T2, T3, T4, R> extends RayFunc {
|
||||
public interface RayFunc5<T0, T1, T2, T3, T4, R> extends RayFuncR<R> {
|
||||
|
||||
R apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) throws Exception;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ray.api.function;
|
||||
* Functional interface for a remote function that has 6 parameters.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RayFunc6<T0, T1, T2, T3, T4, T5, R> extends RayFunc {
|
||||
public interface RayFunc6<T0, T1, T2, T3, T4, T5, R> extends RayFuncR<R> {
|
||||
|
||||
R apply(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.ray.api.function;
|
||||
|
||||
/**
|
||||
* Interface of all Ray remote functions which have a return value
|
||||
*
|
||||
* @param <R> Type of function return value
|
||||
*/
|
||||
public interface RayFuncR<R> extends RayFunc {
|
||||
|
||||
}
|
||||
@@ -31,25 +31,68 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
private String jvmOptions = null;
|
||||
private int maxConcurrency = 1;
|
||||
|
||||
public Builder setResources(Map<String, Double> resources) {
|
||||
this.resources = resources;
|
||||
/**
|
||||
* Set a custom resource requirement to reserve for the lifetime of this actor.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param resourceName resource name
|
||||
* @param resourceQuantity resource quantity
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResource(String resourceName, Double resourceQuantity) {
|
||||
this.resources.put(resourceName, resourceQuantity);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom resource requirements to reserve for the lifetime of this actor.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResources(Map<String, Double> resources) {
|
||||
this.resources.putAll(resources);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This specifies the maximum number of times that the actor should be restarted when it dies
|
||||
* unexpectedly. The minimum valid value is 0 (default), which indicates that the actor doesn't
|
||||
* need to be restarted. A value of -1 indicates that an actor should be restarted indefinitely.
|
||||
*
|
||||
* @param maxRestarts max number of actor restarts
|
||||
* @return self
|
||||
*/
|
||||
public Builder setMaxRestarts(int maxRestarts) {
|
||||
this.maxRestarts = maxRestarts;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the JVM options for the Java worker that this actor is running in.
|
||||
*
|
||||
* Note, if this is set, this actor won't share Java worker with other actors or tasks.
|
||||
*
|
||||
* @param jvmOptions JVM options for the Java worker that this actor is running in.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setJvmOptions(String jvmOptions) {
|
||||
this.jvmOptions = jvmOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
// The max number of concurrent calls to allow for this actor.
|
||||
//
|
||||
// The max concurrency defaults to 1 for threaded execution.
|
||||
// Note that the execution order is not guaranteed when max_concurrency > 1.
|
||||
/**
|
||||
* Set the max number of concurrent calls to allow for this actor.
|
||||
*
|
||||
* The max concurrency defaults to 1 for threaded execution.
|
||||
* Note that the execution order is not guaranteed when max_concurrency > 1.
|
||||
*
|
||||
* @param maxConcurrency The max number of concurrent calls to allow for this actor.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setMaxConcurrency(int maxConcurrency) {
|
||||
if (maxConcurrency <= 0) {
|
||||
throw new IllegalArgumentException("maxConcurrency must be greater than 0.");
|
||||
@@ -59,7 +102,7 @@ public class ActorCreationOptions extends BaseTaskOptions {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ActorCreationOptions createActorCreationOptions() {
|
||||
public ActorCreationOptions build() {
|
||||
return new ActorCreationOptions(
|
||||
resources, maxRestarts, jvmOptions, maxConcurrency);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,34 @@ public class CallOptions extends BaseTaskOptions {
|
||||
|
||||
private Map<String, Double> resources = new HashMap<>();
|
||||
|
||||
public Builder setResources(Map<String, Double> resources) {
|
||||
this.resources = resources;
|
||||
/**
|
||||
* Set a custom resource requirement for resource {@code name}.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param name resource name
|
||||
* @param value resource capacity
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResource(String name, Double value) {
|
||||
this.resources.put(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CallOptions createCallOptions() {
|
||||
/**
|
||||
* Set custom requirements for multiple resources.
|
||||
* This method can be called multiple times. If the same resource is set multiple times,
|
||||
* the latest quantity will be used.
|
||||
*
|
||||
* @param resources requirements for multiple resources.
|
||||
* @return self
|
||||
*/
|
||||
public Builder setResources(Map<String, Double> resources) {
|
||||
this.resources.putAll(resources);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CallOptions build() {
|
||||
return new CallOptions(resources);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
newLine("");
|
||||
newLine("package io.ray.api;");
|
||||
newLine("");
|
||||
newLine("import io.ray.api.call.ActorCreator;");
|
||||
newLine("import io.ray.api.call.PyActorCreator;");
|
||||
newLine("import io.ray.api.call.PyTaskCaller;");
|
||||
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;");
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
@@ -31,43 +36,35 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
newLine("import io.ray.api.function.RayFuncVoid" + i + ";");
|
||||
}
|
||||
newLine("import io.ray.api.options.ActorCreationOptions;");
|
||||
newLine("import io.ray.api.options.CallOptions;");
|
||||
newLine("");
|
||||
|
||||
newLine("/**");
|
||||
newLine(" * This class provides type-safe interfaces for `Ray.call` and `Ray.createActor`.");
|
||||
newLine(" **/");
|
||||
newLine("@SuppressWarnings({\"rawtypes\", \"unchecked\"})");
|
||||
newLine("class RayCall {");
|
||||
newLine(1, "// =======================================");
|
||||
newLine(1, "// Methods for remote function invocation.");
|
||||
newLine(1, "// =======================================");
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
buildCalls(i, false, false, true, false);
|
||||
buildCalls(i, false, false, true, true);
|
||||
buildCalls(i, false, false, false, false);
|
||||
buildCalls(i, false, false, false, true);
|
||||
buildCalls(i, false, false, true);
|
||||
buildCalls(i, false, false, false);
|
||||
}
|
||||
|
||||
newLine(1, "// ===========================");
|
||||
newLine(1, "// Methods for actor creation.");
|
||||
newLine(1, "// ===========================");
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
buildCalls(i, false, true, true, false);
|
||||
buildCalls(i, false, true, true, true);
|
||||
buildCalls(i, false, true, true);
|
||||
}
|
||||
|
||||
newLine(1, "// ===========================");
|
||||
newLine(1, "// Cross-language methods.");
|
||||
newLine(1, "// ===========================");
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
buildPyCalls(i, false, false, false);
|
||||
buildPyCalls(i, false, false, true);
|
||||
buildPyCalls(i, false, false);
|
||||
}
|
||||
for (int i = 0; i <= MAX_PARAMETERS; i++) {
|
||||
buildPyCalls(i, false, true, false);
|
||||
buildPyCalls(i, false, true, true);
|
||||
buildPyCalls(i, false, true);
|
||||
}
|
||||
newLine("}");
|
||||
return sb.toString();
|
||||
@@ -83,6 +80,8 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
newLine("");
|
||||
newLine("package io.ray.api;");
|
||||
newLine("");
|
||||
newLine("import io.ray.api.call.ActorTaskCaller;");
|
||||
newLine("import io.ray.api.call.VoidActorTaskCaller;");
|
||||
for (int i = 1; i <= MAX_PARAMETERS; i++) {
|
||||
newLine("import io.ray.api.function.RayFunc" + i + ";");
|
||||
}
|
||||
@@ -93,12 +92,11 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
newLine("/**");
|
||||
newLine(" * This class provides type-safe interfaces for remote actor calls.");
|
||||
newLine(" **/");
|
||||
newLine("@SuppressWarnings({\"rawtypes\", \"unchecked\"})");
|
||||
newLine("interface ActorCall<A> {");
|
||||
newLine("");
|
||||
for (int i = 0; i <= MAX_PARAMETERS - 1; i++) {
|
||||
buildCalls(i, true, false, true, false);
|
||||
buildCalls(i, true, false, false, false);
|
||||
buildCalls(i, true, false, true);
|
||||
buildCalls(i, true, false, false);
|
||||
}
|
||||
newLine("}");
|
||||
return sb.toString();
|
||||
@@ -114,16 +112,16 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
newLine("");
|
||||
newLine("package io.ray.api;");
|
||||
newLine("");
|
||||
newLine("import io.ray.api.call.PyActorTaskCaller;");
|
||||
newLine("import io.ray.api.function.PyActorMethod;");
|
||||
newLine("");
|
||||
newLine("/**");
|
||||
newLine(" * This class provides type-safe interfaces for remote actor calls.");
|
||||
newLine(" **/");
|
||||
newLine("@SuppressWarnings({\"rawtypes\", \"unchecked\"})");
|
||||
newLine("interface PyActorCall {");
|
||||
newLine("");
|
||||
for (int i = 0; i <= MAX_PARAMETERS - 1; i++) {
|
||||
buildPyCalls(i, true, false, false);
|
||||
buildPyCalls(i, true, false);
|
||||
}
|
||||
newLine("}");
|
||||
return sb.toString();
|
||||
@@ -139,11 +137,11 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
* @param forActorCreation Build `Ray.createActor` when true, otherwise build `Ray.call`.
|
||||
*/
|
||||
private void buildCalls(int numParameters, boolean forActor,
|
||||
boolean forActorCreation, boolean hasReturn, boolean hasOptionsParam) {
|
||||
boolean forActorCreation, boolean hasReturn) {
|
||||
// Template of the generated function:
|
||||
// [modifiers] [genericTypes] [returnType] [callFunc]([argsDeclaration]) {
|
||||
// Objects[] args = new Object[]{[args]};
|
||||
// return Ray.internal().[callFunc](f[, getThis()], args[, options]);
|
||||
// return new [Caller](func, args);
|
||||
// }
|
||||
|
||||
String modifiers = forActor ? "default" : "public static";
|
||||
@@ -170,9 +168,13 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
// 2) Construct the `returnType` part.
|
||||
String returnType;
|
||||
if (forActorCreation) {
|
||||
returnType = "ActorHandle<A>";
|
||||
returnType = "ActorCreator<A>";
|
||||
} else {
|
||||
returnType = hasReturn ? "ObjectRef<R>" : "void";
|
||||
if (forActor) {
|
||||
returnType = hasReturn ? "ActorTaskCaller<R>" : "VoidActorTaskCaller";
|
||||
} else {
|
||||
returnType = hasReturn ? "TaskCaller<R>" : "VoidTaskCaller";
|
||||
}
|
||||
}
|
||||
|
||||
// 3) Construct the `argsDeclaration` part.
|
||||
@@ -189,16 +191,21 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
!forActor ? numParameters : numParameters + 1,
|
||||
rayFuncGenericTypes);
|
||||
|
||||
String callFunc = forActorCreation ? "createActor" : "call";
|
||||
String internalCallFunc = forActorCreation ? "createActor" : forActor ? "callActor" : "call";
|
||||
String callFunc = forActorCreation ? "actor" : "task";
|
||||
String caller;
|
||||
if (forActorCreation) {
|
||||
caller = "ActorCreator<>";
|
||||
} else {
|
||||
if (forActor) {
|
||||
caller = hasReturn ? "ActorTaskCaller<>" : "VoidActorTaskCaller";
|
||||
} else {
|
||||
caller = hasReturn ? "TaskCaller<>" : "VoidTaskCaller";
|
||||
}
|
||||
}
|
||||
|
||||
// Enumerate all combinations of the parameters.
|
||||
for (String param : generateParameters(numParameters)) {
|
||||
String argsDeclaration = argsDeclarationPrefix + param;
|
||||
if (hasOptionsParam) {
|
||||
argsDeclaration +=
|
||||
forActorCreation ? "ActorCreationOptions options, " : "CallOptions options, ";
|
||||
}
|
||||
// Trim trailing ", ";
|
||||
argsDeclaration = argsDeclaration.substring(0, argsDeclaration.length() - 2);
|
||||
// Print the first line (method signature).
|
||||
@@ -220,15 +227,13 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
newLine(2, String.format("Object[] args = new Object[]{%s};", args));
|
||||
|
||||
// 5) Construct the third line.
|
||||
String callFuncArgs = "";
|
||||
String ctrArgs = "";
|
||||
if (forActor) {
|
||||
callFuncArgs += "(ActorHandle) this, ";
|
||||
ctrArgs += "(ActorHandle) this, ";
|
||||
}
|
||||
callFuncArgs += "f, args, ";
|
||||
callFuncArgs += forActor ? "" : hasOptionsParam ? "options, " : "null, ";
|
||||
callFuncArgs = callFuncArgs.substring(0, callFuncArgs.length() - 2);
|
||||
newLine(2, String.format("%sRay.internal().%s(%s);",
|
||||
hasReturn ? "return " : "", internalCallFunc, callFuncArgs));
|
||||
ctrArgs += "f, args, ";
|
||||
ctrArgs = ctrArgs.substring(0, ctrArgs.length() - 2);
|
||||
newLine(2, String.format("return new %s(%s);", caller, ctrArgs));
|
||||
newLine(1, "}");
|
||||
newLine("");
|
||||
}
|
||||
@@ -241,12 +246,9 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
* @param numParameters the number of parameters
|
||||
* @param forActor Build `actor.call` when true, otherwise build `Ray.call`.
|
||||
* @param forActorCreation Build `Ray.createActor` when true, otherwise build `Ray.call`.
|
||||
* @param hasOptionsParam Add ActorCreationOptions if forActorCreation is true;
|
||||
* Add CallOptions if forActorCreation is false;
|
||||
* No additional param if hasOptionsParam is false.
|
||||
*/
|
||||
private void buildPyCalls(int numParameters, boolean forActor,
|
||||
boolean forActorCreation, boolean hasOptionsParam) {
|
||||
boolean forActorCreation) {
|
||||
String modifiers = forActor ? "default" : "public static";
|
||||
|
||||
String argList = "";
|
||||
@@ -278,43 +280,26 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
paramPrefix += ", ";
|
||||
}
|
||||
|
||||
String optionsParam;
|
||||
if (hasOptionsParam) {
|
||||
optionsParam = forActorCreation ? ", ActorCreationOptions options" : ", CallOptions options";
|
||||
} else {
|
||||
optionsParam = "";
|
||||
}
|
||||
|
||||
String optionsArg;
|
||||
if (forActor) {
|
||||
optionsArg = "";
|
||||
} else {
|
||||
if (hasOptionsParam) {
|
||||
optionsArg = ", options";
|
||||
} else {
|
||||
optionsArg = ", null";
|
||||
}
|
||||
}
|
||||
|
||||
String genericType = forActorCreation ? "" : " <R>";
|
||||
String returnType = !forActorCreation ? "ObjectRef<R>" : "PyActorHandle";
|
||||
String funcName = forActorCreation ? "createActor" : "call";
|
||||
String internalCallFunc = forActorCreation ? "createActor" :
|
||||
forActor ? "callActor" : "call";
|
||||
String returnType = forActorCreation ? "PyActorCreator" :
|
||||
forActor ? "PyActorTaskCaller<R>" : "PyTaskCaller<R>";
|
||||
|
||||
String funcName = forActorCreation ? "actor" : "task";
|
||||
String caller = forActorCreation ? "PyActorCreator" :
|
||||
forActor ? "PyActorTaskCaller<>" : "PyTaskCaller<>";
|
||||
funcArgs += ", args";
|
||||
// Method signature.
|
||||
newLine(1, String.format(
|
||||
"%s%s %s %s(%s%s) {", modifiers, genericType,
|
||||
returnType, funcName, paramPrefix + paramList, optionsParam
|
||||
"%s%s %s %s(%s) {", modifiers, genericType,
|
||||
returnType, funcName, paramPrefix + paramList
|
||||
));
|
||||
// Method body.
|
||||
newLine(2, String.format("Object[] args = new Object[]{%s};", argList));
|
||||
if (forActor) {
|
||||
newLine(2, String.format("return Ray.internal().%s((PyActorHandle)this, %s%s);",
|
||||
internalCallFunc, funcArgs, optionsArg));
|
||||
newLine(2, String.format("return new %s((PyActorHandle)this, %s);",
|
||||
caller, funcArgs));
|
||||
} else {
|
||||
newLine(2, String.format("return Ray.internal().%s(%s%s);",
|
||||
internalCallFunc, funcArgs, optionsArg));
|
||||
newLine(2, String.format("return new %s(%s);", caller, funcArgs));
|
||||
}
|
||||
newLine(1, "}");
|
||||
newLine("");
|
||||
@@ -339,15 +324,15 @@ public class RayCallGenerator extends BaseGenerator {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
String path = System.getProperty("user.dir")
|
||||
+ "/api/src/main/java/io.ray/api/RayCall.java";
|
||||
+ "/api/src/main/java/io/ray/api/RayCall.java";
|
||||
FileUtils.write(new File(path), new RayCallGenerator().generateRayCallDotJava(),
|
||||
Charset.defaultCharset());
|
||||
path = System.getProperty("user.dir")
|
||||
+ "/api/src/main/java/io.ray/api/ActorCall.java";
|
||||
+ "/api/src/main/java/io/ray/api/ActorCall.java";
|
||||
FileUtils.write(new File(path), new RayCallGenerator().generateActorCallDotJava(),
|
||||
Charset.defaultCharset());
|
||||
path = System.getProperty("user.dir")
|
||||
+ "/api/src/main/java/io.ray/api/PyActorCall.java";
|
||||
+ "/api/src/main/java/io/ray/api/PyActorCall.java";
|
||||
FileUtils.write(new File(path), new RayCallGenerator().generatePyActorCallDotJava(),
|
||||
Charset.defaultCharset());
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RayFuncGenerator extends BaseGenerator {
|
||||
newLine("@FunctionalInterface");
|
||||
String className = "RayFunc" + (hasReturn ? "" : "Void") + numParameters;
|
||||
newLine(String.format("public interface %s%s extends %s {",
|
||||
className, genericTypes, hasReturn ? "RayFunc" : "RayFuncVoid"));
|
||||
className, genericTypes, hasReturn ? "RayFuncR<R>" : "RayFuncVoid"));
|
||||
newLine("");
|
||||
indents(1);
|
||||
newLine(String.format("%s apply(%s) throws Exception;", hasReturn ? "R" : "void", paramList));
|
||||
|
||||
@@ -10,7 +10,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
@Test
|
||||
public void singleLatencyTest() {
|
||||
int times = 10;
|
||||
ActorHandle<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
ActorHandle<Adder> adder = Ray.actor(ActorPressTest.Adder::new).remote();
|
||||
super.singleLatencyTest(times, adder);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
public void maxTest() {
|
||||
int clientNum = 2;
|
||||
int totalNum = 20;
|
||||
ActorHandle<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
ActorHandle<Adder> adder = Ray.actor(ActorPressTest.Adder::new).remote();
|
||||
PressureTestParameter pressureTestParameter = new PressureTestParameter();
|
||||
pressureTestParameter.setClientNum(clientNum);
|
||||
pressureTestParameter.setTotalNum(totalNum);
|
||||
@@ -32,7 +32,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
int clientNum = 2;
|
||||
int totalQps = 2;
|
||||
int duration = 3;
|
||||
ActorHandle<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
ActorHandle<Adder> adder = Ray.actor(ActorPressTest.Adder::new).remote();
|
||||
PressureTestParameter pressureTestParameter = new PressureTestParameter();
|
||||
pressureTestParameter.setClientNum(clientNum);
|
||||
pressureTestParameter.setTotalQps(totalQps);
|
||||
@@ -44,7 +44,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
|
||||
@Override
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
return ((ActorHandle<Adder>) rayActor).call(Adder::add, 10);
|
||||
return ((ActorHandle<Adder>) rayActor).task(Adder::add, 10).remote();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class MaxPressureTest extends RayBenchmarkTest {
|
||||
@Override
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
|
||||
return Ray.call(MaxPressureTest::currentTime);
|
||||
return Ray.task(MaxPressureTest::currentTime).remote();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MicroBenchmarks {
|
||||
Ray.init();
|
||||
try {
|
||||
time(() -> {
|
||||
Ray.call(MicroBenchmarks::simpleFunction);
|
||||
Ray.task(MicroBenchmarks::simpleFunction).remote();
|
||||
}, numRepeats, "task submission");
|
||||
} finally {
|
||||
Ray.shutdown();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RateLimiterPressureTest extends RayBenchmarkTest {
|
||||
@Override
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
|
||||
return Ray.call(RateLimiterPressureTest::currentTime);
|
||||
return Ray.task(RateLimiterPressureTest::currentTime).remote();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -135,7 +135,7 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||
// defect of the Java compiler.
|
||||
// TODO(hchen): Figure out how to avoid manually declaring `RayFunc` type in this case.
|
||||
RayFunc1<PressureTestParameter, List<Long>> func = RayBenchmarkTest::singleClient;
|
||||
objectRefs[i] = Ray.call(func, pressureTestParameter);
|
||||
objectRefs[i] = Ray.task(func, pressureTestParameter).remote();
|
||||
}
|
||||
for (int i = 0; i < clientNum; i++) {
|
||||
List<Long> subCounterList = objectRefs[i].get();
|
||||
|
||||
@@ -23,7 +23,7 @@ public class SingleLatencyTest extends RayBenchmarkTest {
|
||||
|
||||
@Override
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
return Ray.call(SingleLatencyTest::doFunc);
|
||||
return Ray.task(SingleLatencyTest::doFunc).remote();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import org.testng.Assert;
|
||||
@@ -30,13 +29,13 @@ public class ActorConcurrentCallTest extends BaseTest {
|
||||
public void testConcurrentCall() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
|
||||
ActorCreationOptions op = new ActorCreationOptions.Builder()
|
||||
.setMaxConcurrency(3)
|
||||
.createActorCreationOptions();
|
||||
ActorHandle<ConcurrentActor> actor = Ray.createActor(ConcurrentActor::new, op);
|
||||
ObjectRef<String> obj1 = actor.call(ConcurrentActor::countDown);
|
||||
ObjectRef<String> obj2 = actor.call(ConcurrentActor::countDown);
|
||||
ObjectRef<String> obj3 = actor.call(ConcurrentActor::countDown);
|
||||
ActorHandle<ConcurrentActor> actor =
|
||||
Ray.actor(ConcurrentActor::new)
|
||||
.setMaxConcurrency(3)
|
||||
.remote();
|
||||
ObjectRef<String> obj1 = actor.task(ConcurrentActor::countDown).remote();
|
||||
ObjectRef<String> obj2 = actor.task(ConcurrentActor::countDown).remote();
|
||||
ObjectRef<String> obj3 = actor.task(ConcurrentActor::countDown).remote();
|
||||
|
||||
List<Integer> expectedResult = ImmutableList.of(1, 2, 3);
|
||||
Assert.assertEquals(obj1.get(), "ok");
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.ray.api.Ray;
|
||||
import io.ray.api.exception.RayActorException;
|
||||
import io.ray.api.id.ActorId;
|
||||
import io.ray.api.id.UniqueId;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import io.ray.runtime.util.SystemUtil;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -43,35 +42,33 @@ public class ActorRestartTest extends BaseTest {
|
||||
|
||||
public void testActorRestart() throws InterruptedException, IOException {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorCreationOptions options =
|
||||
new ActorCreationOptions.Builder().setMaxRestarts(1).createActorCreationOptions();
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, options);
|
||||
ActorHandle<Counter> actor = Ray.actor(Counter::new).setMaxRestarts(1).remote();
|
||||
// Call increase 3 times.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
actor.call(Counter::increase).get();
|
||||
actor.task(Counter::increase).remote().get();
|
||||
}
|
||||
|
||||
Assert.assertFalse(actor.call(Counter::wasCurrentActorRestarted).get());
|
||||
Assert.assertFalse(actor.task(Counter::wasCurrentActorRestarted).remote().get());
|
||||
|
||||
// Kill the actor process.
|
||||
int pid = actor.call(Counter::getPid).get();
|
||||
int pid = actor.task(Counter::getPid).remote().get();
|
||||
Runtime.getRuntime().exec("kill -9 " + pid);
|
||||
// Wait for the actor to be killed.
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
|
||||
int value = actor.call(Counter::increase).get();
|
||||
int value = actor.task(Counter::increase).remote().get();
|
||||
Assert.assertEquals(value, 1);
|
||||
|
||||
Assert.assertTrue(actor.call(Counter::wasCurrentActorRestarted).get());
|
||||
Assert.assertTrue(actor.task(Counter::wasCurrentActorRestarted).remote().get());
|
||||
|
||||
// Kill the actor process again.
|
||||
pid = actor.call(Counter::getPid).get();
|
||||
pid = actor.task(Counter::getPid).remote().get();
|
||||
Runtime.getRuntime().exec("kill -9 " + pid);
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
|
||||
// Try calling increase on this actor again and this should fail.
|
||||
try {
|
||||
actor.call(Counter::increase).get();
|
||||
actor.task(Counter::increase).remote().get();
|
||||
Assert.fail("The above task didn't fail.");
|
||||
} catch (RayActorException e) {
|
||||
// We should receive a RayActorException because the actor is dead.
|
||||
@@ -122,25 +119,24 @@ public class ActorRestartTest extends BaseTest {
|
||||
|
||||
public void testActorCheckpointing() throws IOException, InterruptedException {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorCreationOptions options =
|
||||
new ActorCreationOptions.Builder().setMaxRestarts(1).createActorCreationOptions();
|
||||
ActorHandle<CheckpointableCounter> actor = Ray.createActor(CheckpointableCounter::new, options);
|
||||
ActorHandle<CheckpointableCounter> actor = Ray.actor(CheckpointableCounter::new)
|
||||
.setMaxRestarts(1).remote();
|
||||
// Call increase 3 times.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
actor.call(CheckpointableCounter::increase).get();
|
||||
actor.task(CheckpointableCounter::increase).remote().get();
|
||||
}
|
||||
// Assert that the actor wasn't resumed from a checkpoint.
|
||||
Assert.assertFalse(actor.call(CheckpointableCounter::wasResumedFromCheckpoint).get());
|
||||
int pid = actor.call(CheckpointableCounter::getPid).get();
|
||||
Assert.assertFalse(actor.task(CheckpointableCounter::wasResumedFromCheckpoint).remote().get());
|
||||
int pid = actor.task(CheckpointableCounter::getPid).remote().get();
|
||||
Runtime.getRuntime().exec("kill -9 " + pid);
|
||||
// Wait for the actor to be killed.
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
|
||||
// Try calling increase on this actor again and check the value is now 4.
|
||||
int value = actor.call(CheckpointableCounter::increase).get();
|
||||
int value = actor.task(CheckpointableCounter::increase).remote().get();
|
||||
Assert.assertEquals(value, 4);
|
||||
// Assert that the actor was resumed from a checkpoint.
|
||||
Assert.assertTrue(actor.call(CheckpointableCounter::wasResumedFromCheckpoint).get());
|
||||
Assert.assertTrue(actor.task(CheckpointableCounter::wasResumedFromCheckpoint).remote().get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,15 @@ public class ActorTest extends BaseTest {
|
||||
|
||||
public void testCreateAndCallActor() {
|
||||
// Test creating an actor from a constructor
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
ActorHandle<Counter> actor = Ray.actor(Counter::new, 1).remote();
|
||||
Assert.assertNotEquals(actor.getId(), ActorId.NIL);
|
||||
// A java actor is not a python actor
|
||||
Assert.assertFalse(actor instanceof PyActorHandle);
|
||||
// Test calling an actor
|
||||
Assert.assertEquals(Integer.valueOf(1), actor.call(Counter::getValue).get());
|
||||
actor.call(Counter::increase, 1);
|
||||
Assert.assertEquals(Integer.valueOf(3), actor.call(Counter::increaseAndGet, 1).get());
|
||||
Assert.assertEquals(Integer.valueOf(1), actor.task(Counter::getValue).remote().get());
|
||||
actor.task(Counter::increase, 1).remote();
|
||||
Assert.assertEquals(Integer.valueOf(3),
|
||||
actor.task(Counter::increaseAndGet, 1).remote().get());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,8 +64,8 @@ public class ActorTest extends BaseTest {
|
||||
* get. To enable getting it twice, we cache the object in `RayObjectImpl`.
|
||||
*/
|
||||
public void testGetObjectTwice() {
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
ObjectRef<Integer> result = actor.call(Counter::getValue);
|
||||
ActorHandle<Counter> actor = Ray.actor(Counter::new, 1).remote();
|
||||
ObjectRef<Integer> result = actor.task(Counter::getValue).remote();
|
||||
Assert.assertEquals(result.get(), Integer.valueOf(1));
|
||||
Assert.assertEquals(result.get(), Integer.valueOf(1));
|
||||
// TODO(hchen): The following code will still fail, and can be fixed by using ref counting.
|
||||
@@ -72,10 +73,10 @@ public class ActorTest extends BaseTest {
|
||||
}
|
||||
|
||||
public void testCallActorWithLargeObject() {
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
ActorHandle<Counter> actor = Ray.actor(Counter::new, 1).remote();
|
||||
TestUtils.LargeObject largeObject = new TestUtils.LargeObject();
|
||||
Assert.assertEquals(Integer.valueOf(largeObject.data.length + 1),
|
||||
actor.call(Counter::accessLargeObject, largeObject).get());
|
||||
actor.task(Counter::accessLargeObject, largeObject).remote().get());
|
||||
}
|
||||
|
||||
static Counter factory(int initValue) {
|
||||
@@ -84,36 +85,36 @@ public class ActorTest extends BaseTest {
|
||||
|
||||
public void testCreateActorFromFactory() {
|
||||
// Test creating an actor from a factory method
|
||||
ActorHandle<Counter> actor = Ray.createActor(ActorTest::factory, 1);
|
||||
ActorHandle<Counter> actor = Ray.actor(ActorTest::factory, 1).remote();
|
||||
Assert.assertNotEquals(actor.getId(), UniqueId.NIL);
|
||||
// Test calling an actor
|
||||
Assert.assertEquals(Integer.valueOf(1), actor.call(Counter::getValue).get());
|
||||
Assert.assertEquals(Integer.valueOf(1), actor.task(Counter::getValue).remote().get());
|
||||
}
|
||||
|
||||
static int testActorAsFirstParameter(ActorHandle<Counter> actor, int delta) {
|
||||
ObjectRef<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||
ObjectRef<Integer> res = actor.task(Counter::increaseAndGet, delta).remote();
|
||||
return res.get();
|
||||
}
|
||||
|
||||
static int testActorAsSecondParameter(int delta, ActorHandle<Counter> actor) {
|
||||
ObjectRef<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||
ObjectRef<Integer> res = actor.task(Counter::increaseAndGet, delta).remote();
|
||||
return res.get();
|
||||
}
|
||||
|
||||
static int testActorAsFieldOfParameter(List<ActorHandle<Counter>> actor, int delta) {
|
||||
ObjectRef<Integer> res = actor.get(0).call(Counter::increaseAndGet, delta);
|
||||
ObjectRef<Integer> res = actor.get(0).task(Counter::increaseAndGet, delta).remote();
|
||||
return res.get();
|
||||
}
|
||||
|
||||
public void testPassActorAsParameter() {
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 0);
|
||||
ActorHandle<Counter> actor = Ray.actor(Counter::new, 0).remote();
|
||||
Assert.assertEquals(Integer.valueOf(1),
|
||||
Ray.call(ActorTest::testActorAsFirstParameter, actor, 1).get());
|
||||
Ray.task(ActorTest::testActorAsFirstParameter, actor, 1).remote().get());
|
||||
Assert.assertEquals(Integer.valueOf(11),
|
||||
Ray.call(ActorTest::testActorAsSecondParameter, 10, actor).get());
|
||||
Ray.task(ActorTest::testActorAsSecondParameter, 10, actor).remote().get());
|
||||
Assert.assertEquals(Integer.valueOf(111),
|
||||
Ray.call(ActorTest::testActorAsFieldOfParameter, Collections.singletonList(actor), 100)
|
||||
.get());
|
||||
Ray.task(ActorTest::testActorAsFieldOfParameter,
|
||||
Collections.singletonList(actor), 100).remote().get());
|
||||
}
|
||||
|
||||
// TODO(qwang): Will re-enable this test case once ref counting is supported in Java.
|
||||
@@ -122,9 +123,9 @@ public class ActorTest extends BaseTest {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
|
||||
// The UnreconstructableException is created by raylet.
|
||||
ActorHandle<Counter> counter = Ray.createActor(Counter::new, 100);
|
||||
ActorHandle<Counter> counter = Ray.actor(Counter::new, 100).remote();
|
||||
// Call an actor method.
|
||||
ObjectRef value = counter.call(Counter::getValue);
|
||||
ObjectRef value = counter.task(Counter::getValue).remote();
|
||||
Assert.assertEquals(100, value.get());
|
||||
// Delete the object from the object store.
|
||||
Ray.internal().free(ImmutableList.of(value.getId()), false, false);
|
||||
|
||||
@@ -69,24 +69,24 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
1.234, // Double
|
||||
"example binary".getBytes()}; // byte[]
|
||||
for (Object o : inputs) {
|
||||
ObjectRef res = Ray.call(
|
||||
ObjectRef res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", o.getClass()),
|
||||
o);
|
||||
o).remote();
|
||||
Assert.assertEquals(res.get(), o);
|
||||
}
|
||||
// null
|
||||
{
|
||||
Object input = null;
|
||||
ObjectRef<Object> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", Object.class), input);
|
||||
ObjectRef<Object> res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", Object.class), input).remote();
|
||||
Object r = res.get();
|
||||
Assert.assertEquals(r, input);
|
||||
}
|
||||
// array
|
||||
{
|
||||
int[] input = new int[]{1, 2};
|
||||
ObjectRef<int[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", int[].class), input);
|
||||
ObjectRef<int[]> res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", int[].class), input).remote();
|
||||
int[] r = res.get();
|
||||
Assert.assertEquals(r, input);
|
||||
}
|
||||
@@ -94,8 +94,8 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
{
|
||||
Object[] input = new Object[]{1, 2.3f, 4.56, "789", "10".getBytes(), null, true,
|
||||
new int[]{1, 2}};
|
||||
ObjectRef<Object[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", Object[].class), input);
|
||||
ObjectRef<Object[]> res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", Object[].class), input).remote();
|
||||
Object[] r = res.get();
|
||||
// If we tell the value type is Object, then all numbers will be Number type.
|
||||
Assert.assertEquals(((Number) r[0]).intValue(), input[0]);
|
||||
@@ -119,9 +119,9 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
{
|
||||
Assert.expectThrows(Exception.class, () -> {
|
||||
List<Integer> input = Arrays.asList(1, 2);
|
||||
ObjectRef<List<Integer>> res = Ray.call(
|
||||
ObjectRef<List<Integer>> res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input",
|
||||
(Class<List<Integer>>) input.getClass()), input);
|
||||
(Class<List<Integer>>) input.getClass()), input).remote();
|
||||
List<Integer> r = res.get();
|
||||
Assert.assertEquals(r, input);
|
||||
});
|
||||
@@ -130,26 +130,26 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testPythonCallJavaFunction() {
|
||||
ObjectRef<String> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_func_call_java_function", String.class));
|
||||
ObjectRef<String> res = Ray.task(new PyRemoteFunction<>(
|
||||
PYTHON_MODULE, "py_func_call_java_function", String.class)).remote();
|
||||
Assert.assertEquals(res.get(), "success");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallingPythonActor() {
|
||||
PyActorHandle actor = Ray.createActor(
|
||||
new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes());
|
||||
ObjectRef<byte[]> res = actor.call(
|
||||
PyActorHandle actor = Ray.actor(
|
||||
new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes()).remote();
|
||||
ObjectRef<byte[]> res = actor.task(
|
||||
new PyActorMethod<>("increase", byte[].class),
|
||||
"1".getBytes());
|
||||
"1".getBytes()).remote();
|
||||
Assert.assertEquals(res.get(), "2".getBytes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPythonCallJavaActor() {
|
||||
ObjectRef<byte[]> res = Ray.call(
|
||||
ObjectRef<byte[]> res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_func_call_java_actor", byte[].class),
|
||||
"1".getBytes());
|
||||
"1".getBytes()).remote();
|
||||
Assert.assertEquals(res.get(), "Counter1".getBytes());
|
||||
|
||||
}
|
||||
@@ -158,33 +158,33 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
public void testPassActorHandleFromPythonToJava() {
|
||||
// Call a python function which creates a python actor
|
||||
// and pass the actor handle to callPythonActorHandle.
|
||||
ObjectRef<byte[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_func_pass_python_actor_handle", byte[].class));
|
||||
ObjectRef<byte[]> res = Ray.task(new PyRemoteFunction<>(
|
||||
PYTHON_MODULE, "py_func_pass_python_actor_handle", byte[].class)).remote();
|
||||
Assert.assertEquals(res.get(), "3".getBytes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPassActorHandleFromJavaToPython() {
|
||||
// Create a java actor, and pass actor handle to python.
|
||||
ActorHandle<TestActor> javaActor = Ray.createActor(TestActor::new, "1".getBytes());
|
||||
ActorHandle<TestActor> javaActor = Ray.actor(TestActor::new, "1".getBytes()).remote();
|
||||
Preconditions.checkState(javaActor instanceof NativeActorHandle);
|
||||
byte[] actorHandleBytes = ((NativeActorHandle) javaActor).toBytes();
|
||||
ObjectRef<byte[]> res = Ray.call(
|
||||
ObjectRef<byte[]> res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE,
|
||||
"py_func_call_java_actor_from_handle",
|
||||
byte[].class),
|
||||
actorHandleBytes);
|
||||
actorHandleBytes).remote();
|
||||
Assert.assertEquals(res.get(), "12".getBytes());
|
||||
// Create a python actor, and pass actor handle to python.
|
||||
PyActorHandle pyActor = Ray.createActor(
|
||||
new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes());
|
||||
PyActorHandle pyActor = Ray.actor(
|
||||
new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes()).remote();
|
||||
Preconditions.checkState(pyActor instanceof NativeActorHandle);
|
||||
actorHandleBytes = ((NativeActorHandle) pyActor).toBytes();
|
||||
res = Ray.call(
|
||||
res = Ray.task(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE,
|
||||
"py_func_call_python_actor_from_handle",
|
||||
byte[].class),
|
||||
actorHandleBytes);
|
||||
actorHandleBytes).remote();
|
||||
Assert.assertEquals(res.get(), "3".getBytes());
|
||||
}
|
||||
|
||||
@@ -220,9 +220,9 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
public static byte[] callPythonActorHandle(byte[] value) {
|
||||
// This function will be called from test_cross_language_invocation.py
|
||||
NativePyActorHandle actor = (NativePyActorHandle) NativeActorHandle.fromBytes(value);
|
||||
ObjectRef<byte[]> res = actor.call(
|
||||
ObjectRef<byte[]> res = actor.task(
|
||||
new PyActorMethod<>("increase", byte[].class),
|
||||
"1".getBytes());
|
||||
"1".getBytes()).remote();
|
||||
Assert.assertEquals(res.get(), "3".getBytes());
|
||||
return (byte[]) res.get();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package io.ray.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.WaitResult;
|
||||
import io.ray.api.options.CallOptions;
|
||||
import io.ray.api.runtimecontext.NodeInfo;
|
||||
import java.util.List;
|
||||
import org.testng.Assert;
|
||||
@@ -24,9 +22,9 @@ public class DynamicResourceTest extends BaseTest {
|
||||
// Call a task in advance to warm up the cluster to avoid being too slow to start workers.
|
||||
TestUtils.warmUpCluster();
|
||||
|
||||
CallOptions op1 =
|
||||
new CallOptions.Builder().setResources(ImmutableMap.of("A", 10.0)).createCallOptions();
|
||||
ObjectRef<String> obj = Ray.call(DynamicResourceTest::sayHi, op1);
|
||||
ObjectRef<String> obj = Ray.task(DynamicResourceTest::sayHi)
|
||||
.setResource("A", 10.0)
|
||||
.remote();
|
||||
WaitResult<String> result = Ray.wait(ImmutableList.of(obj), 1, 1000);
|
||||
Assert.assertEquals(result.getReady().size(), 0);
|
||||
|
||||
|
||||
@@ -87,28 +87,28 @@ public class FailureTest extends BaseTest {
|
||||
@Test
|
||||
public void testNormalTaskFailure() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
assertTaskFailedWithRayTaskException(Ray.call(FailureTest::badFunc));
|
||||
assertTaskFailedWithRayTaskException(Ray.task(FailureTest::badFunc).remote());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActorCreationFailure() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorHandle<BadActor> actor = Ray.createActor(BadActor::new, true);
|
||||
assertTaskFailedWithRayTaskException(actor.call(BadActor::badMethod));
|
||||
ActorHandle<BadActor> actor = Ray.actor(BadActor::new, true).remote();
|
||||
assertTaskFailedWithRayTaskException(actor.task(BadActor::badMethod).remote());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActorTaskFailure() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorHandle<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||
assertTaskFailedWithRayTaskException(actor.call(BadActor::badMethod));
|
||||
ActorHandle<BadActor> actor = Ray.actor(BadActor::new, false).remote();
|
||||
assertTaskFailedWithRayTaskException(actor.task(BadActor::badMethod).remote());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWorkerProcessDying() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
try {
|
||||
Ray.call(FailureTest::badFunc2).get();
|
||||
Ray.task(FailureTest::badFunc2).remote().get();
|
||||
Assert.fail("This line shouldn't be reached.");
|
||||
} catch (RayWorkerException e) {
|
||||
// When the worker process dies while executing a task, we should receive an
|
||||
@@ -119,16 +119,16 @@ public class FailureTest extends BaseTest {
|
||||
@Test
|
||||
public void testActorProcessDying() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorHandle<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||
ActorHandle<BadActor> actor = Ray.actor(BadActor::new, false).remote();
|
||||
try {
|
||||
actor.call(BadActor::badMethod2).get();
|
||||
actor.task(BadActor::badMethod2).remote().get();
|
||||
Assert.fail("This line shouldn't be reached.");
|
||||
} catch (RayActorException e) {
|
||||
// When the actor process dies while executing a task, we should receive an
|
||||
// RayActorException.
|
||||
}
|
||||
try {
|
||||
actor.call(BadActor::badMethod).get();
|
||||
actor.task(BadActor::badMethod).remote().get();
|
||||
Assert.fail("This line shouldn't be reached.");
|
||||
} catch (RayActorException e) {
|
||||
// When a actor task is submitted to a dead actor, we should also receive an
|
||||
@@ -143,8 +143,8 @@ public class FailureTest extends BaseTest {
|
||||
FailureTest::badFunc2);
|
||||
TestUtils.warmUpCluster();
|
||||
for (RayFunc0<Integer> badFunc : badFunctions) {
|
||||
ObjectRef<Integer> obj1 = Ray.call(badFunc);
|
||||
ObjectRef<Integer> obj2 = Ray.call(FailureTest::slowFunc);
|
||||
ObjectRef<Integer> obj1 = Ray.task(badFunc).remote();
|
||||
ObjectRef<Integer> obj2 = Ray.task(FailureTest::slowFunc).remote();
|
||||
Instant start = Instant.now();
|
||||
try {
|
||||
Ray.get(Arrays.asList(obj1, obj2));
|
||||
|
||||
@@ -24,9 +24,9 @@ public class HelloWorldTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testHelloWorld() {
|
||||
ObjectRef<String> hello = Ray.call(HelloWorldTest::hello);
|
||||
ObjectRef<String> world = Ray.call(HelloWorldTest::world);
|
||||
String helloWorld = Ray.call(HelloWorldTest::merge, hello, world).get();
|
||||
ObjectRef<String> hello = Ray.task(HelloWorldTest::hello).remote();
|
||||
ObjectRef<String> world = Ray.task(HelloWorldTest::world).remote();
|
||||
String helloWorld = Ray.task(HelloWorldTest::merge, hello, world).remote().get();
|
||||
Assert.assertEquals("hello,world!", helloWorld);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.exception.RayActorException;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import java.util.function.BiConsumer;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterClass;
|
||||
@@ -50,19 +49,20 @@ public class KillActorTest extends BaseTest {
|
||||
}
|
||||
|
||||
private static void remoteKill(ActorHandle<?> actor, boolean noRestart) {
|
||||
ActorHandle<KillerActor> killer = Ray.createActor(KillerActor::new);
|
||||
killer.call(KillerActor::kill, actor, noRestart);
|
||||
ActorHandle<KillerActor> killer = Ray.actor(KillerActor::new).remote();
|
||||
killer.task(KillerActor::kill, actor, noRestart).remote();
|
||||
}
|
||||
|
||||
private void testKillActor(BiConsumer<ActorHandle<?>, Boolean> kill, boolean noRestart) {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
|
||||
ActorCreationOptions options =
|
||||
new ActorCreationOptions.Builder().setMaxRestarts(1).createActorCreationOptions();
|
||||
ActorHandle<HangActor> actor = Ray.createActor(HangActor::new, options);
|
||||
ObjectRef<Boolean> result = actor.call(HangActor::hang);
|
||||
ActorHandle<HangActor> actor = Ray.actor(HangActor::new)
|
||||
.setMaxRestarts(1)
|
||||
.remote();
|
||||
ObjectRef<Boolean> result = actor.task(HangActor::hang).remote();
|
||||
// The actor will hang in this task.
|
||||
Assert.assertEquals(0, Ray.wait(ImmutableList.of(result), 1, 500).getReady().size());
|
||||
Assert.assertEquals(0,
|
||||
Ray.wait(ImmutableList.of(result), 1, 500).getReady().size());
|
||||
|
||||
// Kill the actor
|
||||
kill.accept(actor, noRestart);
|
||||
@@ -79,9 +79,10 @@ public class KillActorTest extends BaseTest {
|
||||
|
||||
if (noRestart) {
|
||||
// The actor should not be restarted.
|
||||
Assert.expectThrows(RayActorException.class, () -> actor.call(HangActor::hang).get());
|
||||
Assert.expectThrows(RayActorException.class,
|
||||
() -> actor.task(HangActor::hang).remote().get());
|
||||
} else {
|
||||
Assert.assertEquals(actor.call(HangActor::ping).get(), "pong");
|
||||
Assert.assertEquals(actor.task(HangActor::ping).remote().get(), "pong");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class MultiLanguageClusterTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testMultiLanguageCluster() {
|
||||
ObjectRef<String> obj = Ray.call(MultiLanguageClusterTest::echo, "hello");
|
||||
ObjectRef<String> obj = Ray.task(MultiLanguageClusterTest::echo, "hello").remote();
|
||||
Assert.assertEquals("hello", obj.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -72,22 +72,22 @@ public class MultiThreadingTest extends BaseTest {
|
||||
// Test calling normal functions.
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
ObjectRef<Integer> obj = Ray.call(MultiThreadingTest::echo, arg);
|
||||
ObjectRef<Integer> obj = Ray.task(MultiThreadingTest::echo, arg).remote();
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, LOOP_COUNTER);
|
||||
|
||||
// Test calling actors.
|
||||
ActorHandle<Echo> echoActor = Ray.createActor(Echo::new);
|
||||
ActorHandle<Echo> echoActor = Ray.actor(Echo::new).remote();
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
ObjectRef<Integer> obj = echoActor.call(Echo::echo, arg);
|
||||
ObjectRef<Integer> obj = echoActor.task(Echo::echo, arg).remote();
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, LOOP_COUNTER);
|
||||
|
||||
// Test creating multi actors
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
ActorHandle<Echo> echoActor1 = Ray.createActor(Echo::new);
|
||||
ActorHandle<Echo> echoActor1 = Ray.actor(Echo::new).remote();
|
||||
try {
|
||||
// Sleep a while to test the case that another actor is created before submitting
|
||||
// tasks to this actor.
|
||||
@@ -95,7 +95,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.warn("Got exception while sleeping.", e);
|
||||
}
|
||||
ObjectRef<Integer> obj = echoActor1.call(Echo::echo, arg);
|
||||
ObjectRef<Integer> obj = echoActor1.task(Echo::echo, arg).remote();
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, 1);
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
|
||||
TestUtils.warmUpCluster();
|
||||
// Test wait for one object in multi threads.
|
||||
ObjectRef<Integer> obj = Ray.call(MultiThreadingTest::echo, 100);
|
||||
ObjectRef<Integer> obj = Ray.task(MultiThreadingTest::echo, 100).remote();
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
WaitResult<Integer> result = Ray.wait(ImmutableList.of(obj), 1, 1000);
|
||||
Assert.assertEquals(1, result.getReady().size());
|
||||
@@ -124,14 +124,14 @@ public class MultiThreadingTest extends BaseTest {
|
||||
public void testInWorker() {
|
||||
// Single-process mode doesn't have real workers.
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ObjectRef<String> obj = Ray.call(MultiThreadingTest::testMultiThreading);
|
||||
ObjectRef<String> obj = Ray.task(MultiThreadingTest::testMultiThreading).remote();
|
||||
Assert.assertEquals("ok", obj.get());
|
||||
}
|
||||
|
||||
public void testGetCurrentActorId() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorHandle<ActorIdTester> actorIdTester = Ray.createActor(ActorIdTester::new);
|
||||
ActorId actorId = actorIdTester.call(ActorIdTester::getCurrentActorId).get();
|
||||
ActorHandle<ActorIdTester> actorIdTester = Ray.actor(ActorIdTester::new).remote();
|
||||
ActorId actorId = actorIdTester.task(ActorIdTester::getCurrentActorId).remote().get();
|
||||
Assert.assertEquals(actorId, actorIdTester.getId());
|
||||
}
|
||||
|
||||
@@ -140,16 +140,16 @@ public class MultiThreadingTest extends BaseTest {
|
||||
*/
|
||||
static Runnable[] generateRunnables() {
|
||||
final ObjectRef<Integer> fooObject = Ray.put(1);
|
||||
final ActorHandle<Echo> fooActor = Ray.createActor(Echo::new);
|
||||
final ActorHandle<Echo> fooActor = Ray.actor(Echo::new).remote();
|
||||
return new Runnable[]{
|
||||
() -> Ray.put(1),
|
||||
() -> Ray.get(fooObject.getId(), fooObject.getType()),
|
||||
fooObject::get,
|
||||
() -> Ray.wait(ImmutableList.of(fooObject)),
|
||||
Ray::getRuntimeContext,
|
||||
() -> Ray.call(MultiThreadingTest::echo, 1),
|
||||
() -> Ray.createActor(Echo::new),
|
||||
() -> fooActor.call(Echo::echo, 1),
|
||||
() -> Ray.task(MultiThreadingTest::echo, 1).remote(),
|
||||
() -> Ray.actor(Echo::new).remote(),
|
||||
() -> fooActor.task(Echo::echo, 1),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
runnables[0].run();
|
||||
}
|
||||
|
||||
// Return true here to make the Ray.call returns an ObjectRef.
|
||||
// Return true here to make the caller.remote() returns an ObjectRef.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testMissingWrapRunnableInWorker() {
|
||||
Ray.call(MultiThreadingTest::testMissingWrapRunnable).get();
|
||||
Ray.task(MultiThreadingTest::testMissingWrapRunnable).remote().get();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -302,7 +302,8 @@ public class MultiThreadingTest extends BaseTest {
|
||||
}
|
||||
|
||||
public void testGetAsyncContextAndSetAsyncContextInWorker() {
|
||||
ObjectRef<Boolean> obj = Ray.call(MultiThreadingTest::testGetAsyncContextAndSetAsyncContext);
|
||||
ObjectRef<Boolean> obj = Ray.task(
|
||||
MultiThreadingTest::testGetAsyncContextAndSetAsyncContext).remote();
|
||||
Assert.assertTrue(obj.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class PlasmaFreeTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testDeleteObjects() {
|
||||
ObjectRef<String> helloId = Ray.call(PlasmaFreeTest::hello);
|
||||
ObjectRef<String> helloId = Ray.task(PlasmaFreeTest::hello).remote();
|
||||
String helloString = helloId.get();
|
||||
Assert.assertEquals("hello", helloString);
|
||||
Ray.internal().free(ImmutableList.of(helloId.getId()), true, false);
|
||||
@@ -35,7 +35,7 @@ public class PlasmaFreeTest extends BaseTest {
|
||||
@Test
|
||||
public void testDeleteCreatingTasks() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ObjectRef<String> helloId = Ray.call(PlasmaFreeTest::hello);
|
||||
ObjectRef<String> helloId = Ray.task(PlasmaFreeTest::hello).remote();
|
||||
Assert.assertEquals("hello", helloId.get());
|
||||
Ray.internal().free(ImmutableList.of(helloId.getId()), true, true);
|
||||
|
||||
|
||||
@@ -68,26 +68,26 @@ public class RayCallTest extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void testType() {
|
||||
Assert.assertEquals(1, (int) Ray.call(RayCallTest::testInt, 1).get());
|
||||
Assert.assertEquals(1, (byte) Ray.call(RayCallTest::testByte, (byte) 1).get());
|
||||
Assert.assertEquals(1, (short) Ray.call(RayCallTest::testShort, (short) 1).get());
|
||||
Assert.assertEquals(1, (long) Ray.call(RayCallTest::testLong, 1L).get());
|
||||
Assert.assertEquals(1.0, Ray.call(RayCallTest::testDouble, 1.0).get(), 0.0);
|
||||
Assert.assertEquals(1.0f, Ray.call(RayCallTest::testFloat, 1.0f).get(), 0.0);
|
||||
Assert.assertTrue(Ray.call(RayCallTest::testBool, true).get());
|
||||
Assert.assertEquals("foo", Ray.call(RayCallTest::testString, "foo").get());
|
||||
Assert.assertEquals(1, (int) Ray.task(RayCallTest::testInt, 1).remote().get());
|
||||
Assert.assertEquals(1, (byte) Ray.task(RayCallTest::testByte, (byte) 1).remote().get());
|
||||
Assert.assertEquals(1, (short) Ray.task(RayCallTest::testShort, (short) 1).remote().get());
|
||||
Assert.assertEquals(1, (long) Ray.task(RayCallTest::testLong, 1L).remote().get());
|
||||
Assert.assertEquals(1.0, Ray.task(RayCallTest::testDouble, 1.0).remote().get(), 0.0);
|
||||
Assert.assertEquals(1.0f, Ray.task(RayCallTest::testFloat, 1.0f).remote().get(), 0.0);
|
||||
Assert.assertTrue(Ray.task(RayCallTest::testBool, true).remote().get());
|
||||
Assert.assertEquals("foo", Ray.task(RayCallTest::testString, "foo").remote().get());
|
||||
List<Integer> list = ImmutableList.of(1, 2, 3);
|
||||
Assert.assertEquals(list, Ray.call(RayCallTest::testList, list).get());
|
||||
Assert.assertEquals(list, Ray.task(RayCallTest::testList, list).remote().get());
|
||||
Map<String, Integer> map = ImmutableMap.of("1", 1, "2", 2);
|
||||
Assert.assertEquals(map, Ray.call(RayCallTest::testMap, map).get());
|
||||
Assert.assertEquals(map, Ray.task(RayCallTest::testMap, map).remote().get());
|
||||
TestUtils.LargeObject largeObject = new TestUtils.LargeObject();
|
||||
Assert.assertNotNull(Ray.call(RayCallTest::testLargeObject, largeObject).get());
|
||||
Assert.assertNotNull(Ray.task(RayCallTest::testLargeObject, largeObject).remote().get());
|
||||
|
||||
// TODO(edoakes): this test doesn't work now that we've switched to direct call
|
||||
// mode. To make it work, we need to implement the same protocol for resolving
|
||||
// passed ObjectIDs that we have in Python.
|
||||
// ObjectId randomObjectId = ObjectId.fromRandom();
|
||||
// Ray.call(RayCallTest::testNoReturn, randomObjectId);
|
||||
// Ray.task(RayCallTest::testNoReturn, randomObjectId).remote();
|
||||
// Assert.assertEquals(((int) Ray.get(randomObjectId, Integer.class)), 1);
|
||||
}
|
||||
|
||||
@@ -121,13 +121,18 @@ public class RayCallTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testNumberOfParameters() {
|
||||
Assert.assertEquals(0, (int) Ray.call(RayCallTest::testNoParam).get());
|
||||
Assert.assertEquals(1, (int) Ray.call(RayCallTest::testOneParam, 1).get());
|
||||
Assert.assertEquals(2, (int) Ray.call(RayCallTest::testTwoParams, 1, 1).get());
|
||||
Assert.assertEquals(3, (int) Ray.call(RayCallTest::testThreeParams, 1, 1, 1).get());
|
||||
Assert.assertEquals(4, (int) Ray.call(RayCallTest::testFourParams, 1, 1, 1, 1).get());
|
||||
Assert.assertEquals(5, (int) Ray.call(RayCallTest::testFiveParams, 1, 1, 1, 1, 1).get());
|
||||
Assert.assertEquals(6, (int) Ray.call(RayCallTest::testSixParams, 1, 1, 1, 1, 1, 1).get());
|
||||
Assert.assertEquals(0, (int) Ray.task(RayCallTest::testNoParam).remote().get());
|
||||
Assert.assertEquals(1, (int) Ray.task(RayCallTest::testOneParam, 1).remote().get());
|
||||
Assert.assertEquals(2, (int) Ray.task(
|
||||
RayCallTest::testTwoParams, 1, 1).remote().get());
|
||||
Assert.assertEquals(3, (int) Ray.task(
|
||||
RayCallTest::testThreeParams, 1, 1, 1).remote().get());
|
||||
Assert.assertEquals(4, (int) Ray.task(
|
||||
RayCallTest::testFourParams, 1, 1, 1, 1).remote().get());
|
||||
Assert.assertEquals(5, (int) Ray.task(
|
||||
RayCallTest::testFiveParams, 1, 1, 1, 1, 1).remote().get());
|
||||
Assert.assertEquals(6, (int) Ray.task(
|
||||
RayCallTest::testSixParams, 1, 1, 1, 1, 1, 1).remote().get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ public class RaySerializerTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testSerializePyActor() {
|
||||
PyActorHandle pyActor = Ray.createActor(
|
||||
new PyActorClass("test", "RaySerializerTest"));
|
||||
PyActorHandle pyActor = Ray.actor(
|
||||
new PyActorClass("test", "RaySerializerTest")).remote();
|
||||
NativeRayObject nativeRayObject = ObjectSerializer.serialize(pyActor);
|
||||
PyActorHandle result = (PyActorHandle) ObjectSerializer
|
||||
.deserialize(nativeRayObject, null, Object.class);
|
||||
|
||||
@@ -31,8 +31,8 @@ public class RayletConfigTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRayletConfigPassThrough() {
|
||||
ActorHandle<TestActor> actor = Ray.createActor(TestActor::new);
|
||||
String configValue = actor.call(TestActor::getConfigValue).get();
|
||||
ActorHandle<TestActor> actor = Ray.actor(TestActor::new).remote();
|
||||
String configValue = actor.task(TestActor::getConfigValue).remote().get();
|
||||
Assert.assertEquals(configValue, RAY_CONFIG_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RedisPasswordTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRedisPassword() {
|
||||
ObjectRef<String> obj = Ray.call(RedisPasswordTest::echo, "hello");
|
||||
ObjectRef<String> obj = Ray.task(RedisPasswordTest::echo, "hello").remote();
|
||||
Assert.assertEquals("hello", obj.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.WaitResult;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import io.ray.api.options.CallOptions;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterClass;
|
||||
@@ -42,20 +41,19 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
@Test
|
||||
public void testMethods() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
CallOptions callOptions1 =
|
||||
new CallOptions.Builder().setResources(ImmutableMap.of("CPU", 4.0)).createCallOptions();
|
||||
|
||||
// This is a case that can satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
ObjectRef<Integer> result1 = Ray.call(ResourcesManagementTest::echo, 100, callOptions1);
|
||||
ObjectRef<Integer> result1 = Ray.task(ResourcesManagementTest::echo, 100)
|
||||
.setResource("CPU", 4.0)
|
||||
.remote();
|
||||
Assert.assertEquals(100, (int) result1.get());
|
||||
|
||||
CallOptions callOptions2 =
|
||||
new CallOptions.Builder().setResources(ImmutableMap.of("CPU", 4.0)).createCallOptions();
|
||||
|
||||
// This is a case that can't satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
final ObjectRef<Integer> result2 = Ray.call(ResourcesManagementTest::echo, 200, callOptions2);
|
||||
final ObjectRef<Integer> result2 = Ray.task(ResourcesManagementTest::echo, 200)
|
||||
.setResource("CPU", 4.0)
|
||||
.remote();
|
||||
WaitResult<Integer> waitResult = Ray.wait(ImmutableList.of(result2), 1, 1000);
|
||||
|
||||
Assert.assertEquals(1, waitResult.getReady().size());
|
||||
@@ -63,7 +61,7 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
|
||||
try {
|
||||
CallOptions callOptions3 =
|
||||
new CallOptions.Builder().setResources(ImmutableMap.of("CPU", 0.0)).createCallOptions();
|
||||
new CallOptions.Builder().setResources(ImmutableMap.of("CPU", 0.0)).build();
|
||||
Assert.fail();
|
||||
} catch (RuntimeException e) {
|
||||
// We should receive a RuntimeException indicates that we should not
|
||||
@@ -75,22 +73,21 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
public void testActors() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
|
||||
ActorCreationOptions actorCreationOptions1 = new ActorCreationOptions.Builder()
|
||||
.setResources(ImmutableMap.of("CPU", 2.0)).createActorCreationOptions();
|
||||
// This is a case that can satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
ActorHandle<Echo> echo1 = Ray.createActor(Echo::new, actorCreationOptions1);
|
||||
final ObjectRef<Integer> result1 = echo1.call(Echo::echo, 100);
|
||||
ActorHandle<Echo> echo1 = Ray.actor(Echo::new)
|
||||
.setResource("CPU", 2.0)
|
||||
.remote();
|
||||
final ObjectRef<Integer> result1 = echo1.task(Echo::echo, 100).remote();
|
||||
Assert.assertEquals(100, (int) result1.get());
|
||||
|
||||
// This is a case that can't satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
ActorCreationOptions actorCreationOptions2 = new ActorCreationOptions.Builder()
|
||||
.setResources(ImmutableMap.of("CPU", 8.0)).createActorCreationOptions();
|
||||
|
||||
ActorHandle<Echo> echo2 =
|
||||
Ray.createActor(Echo::new, actorCreationOptions2);
|
||||
final ObjectRef<Integer> result2 = echo2.call(Echo::echo, 100);
|
||||
Ray.actor(Echo::new)
|
||||
.setResource("CPU", 8.0)
|
||||
.remote();
|
||||
final ObjectRef<Integer> result2 = echo2.task(Echo::echo, 100).remote();
|
||||
WaitResult<Integer> waitResult = Ray.wait(ImmutableList.of(result2), 1, 1000);
|
||||
|
||||
Assert.assertEquals(0, waitResult.getReady().size());
|
||||
|
||||
@@ -60,9 +60,9 @@ public class RuntimeContextTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRuntimeContextInActor() {
|
||||
ActorHandle<RuntimeContextTester> actor = Ray.createActor(RuntimeContextTester::new);
|
||||
ActorHandle<RuntimeContextTester> actor = Ray.actor(RuntimeContextTester::new).remote();
|
||||
Assert.assertEquals("ok",
|
||||
actor.call(RuntimeContextTester::testRuntimeContext, actor.getId()).get());
|
||||
actor.task(RuntimeContextTester::testRuntimeContext, actor.getId()).remote().get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ public class SingleProcessModeTest extends BaseTest {
|
||||
List<ActorHandle<MyActor>> actors = new ArrayList<>();
|
||||
Map<ActorId, Long> actorThreadIds = new HashMap<>();
|
||||
for (int i = 0; i < NUM_ACTOR_INSTANCE; ++i) {
|
||||
ActorHandle<MyActor> actor = Ray.createActor(MyActor::new);
|
||||
ActorHandle<MyActor> actor = Ray.actor(MyActor::new).remote();
|
||||
actors.add(actor);
|
||||
actorThreadIds.put(actor.getId(), actor.call(MyActor::getThreadId).get());
|
||||
actorThreadIds.put(actor.getId(), actor.task(MyActor::getThreadId).remote().get());
|
||||
}
|
||||
|
||||
Map<ActorId, List<ObjectRef<Long>>> allResults = new HashMap<>();
|
||||
@@ -43,7 +43,7 @@ public class SingleProcessModeTest extends BaseTest {
|
||||
final ActorHandle<MyActor> actor = actors.get(i);
|
||||
List<ObjectRef<Long>> thisActorResult = new ArrayList<>();
|
||||
for (int j = 0; j < TIMES_TO_CALL_PER_ACTOR; ++j) {
|
||||
thisActorResult.add(actor.call(MyActor::getThreadId));
|
||||
thisActorResult.add(actor.task(MyActor::getThreadId).remote());
|
||||
}
|
||||
allResults.put(actor.getId(), thisActorResult);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class StressTest extends BaseTest {
|
||||
for (int i = 0; i < numIterations; i++) {
|
||||
List<ObjectId> resultIds = new ArrayList<>();
|
||||
for (int j = 0; j < numTasks; j++) {
|
||||
resultIds.add(Ray.call(StressTest::echo, 1).getId());
|
||||
resultIds.add(Ray.task(StressTest::echo, 1).remote().getId());
|
||||
}
|
||||
|
||||
for (Integer result : Ray.<Integer>get(resultIds, Integer.class)) {
|
||||
@@ -37,9 +37,9 @@ public class StressTest extends BaseTest {
|
||||
@Test
|
||||
public void testDependency() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ObjectRef<Integer> x = Ray.call(StressTest::echo, 1);
|
||||
ObjectRef<Integer> x = Ray.task(StressTest::echo, 1).remote();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
x = Ray.call(StressTest::echo, x);
|
||||
x = Ray.task(StressTest::echo, x).remote();
|
||||
}
|
||||
|
||||
Assert.assertEquals(x.get(), Integer.valueOf(1));
|
||||
@@ -63,7 +63,7 @@ public class StressTest extends BaseTest {
|
||||
public int ping(int n) {
|
||||
List<ObjectId> objectIds = new ArrayList<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
objectIds.add(actor.call(Actor::ping).getId());
|
||||
objectIds.add(actor.task(Actor::ping).remote().getId());
|
||||
}
|
||||
int sum = 0;
|
||||
for (Integer result : Ray.<Integer>get(objectIds, Integer.class)) {
|
||||
@@ -76,11 +76,11 @@ public class StressTest extends BaseTest {
|
||||
@Test
|
||||
public void testSubmittingManyTasksToOneActor() throws Exception {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorHandle<Actor> actor = Ray.createActor(Actor::new);
|
||||
ActorHandle<Actor> actor = Ray.actor(Actor::new).remote();
|
||||
List<ObjectId> objectIds = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ActorHandle<Worker> worker = Ray.createActor(Worker::new, actor);
|
||||
objectIds.add(worker.call(Worker::ping, 100).getId());
|
||||
ActorHandle<Worker> worker = Ray.actor(Worker::new, actor).remote();
|
||||
objectIds.add(worker.task(Worker::ping, 100).remote().getId());
|
||||
}
|
||||
|
||||
for (Integer result : Ray.<Integer>get(objectIds, Integer.class)) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public class TestUtils {
|
||||
* idle workers in Raylet's worker pool.
|
||||
*/
|
||||
public static void warmUpCluster() {
|
||||
ObjectRef<String> obj = Ray.call(TestUtils::hi);
|
||||
ObjectRef<String> obj = Ray.task(TestUtils::hi).remote();
|
||||
Assert.assertEquals(obj.get(), "hi");
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ public class WaitTest extends BaseTest {
|
||||
// Call a task in advance to warm up the cluster to avoid being too slow to start workers.
|
||||
TestUtils.warmUpCluster();
|
||||
|
||||
ObjectRef<String> obj1 = Ray.call(WaitTest::hi);
|
||||
ObjectRef<String> obj2 = Ray.call(WaitTest::delayedHi);
|
||||
ObjectRef<String> obj1 = Ray.task(WaitTest::hi).remote();
|
||||
ObjectRef<String> obj2 = Ray.task(WaitTest::delayedHi).remote();
|
||||
|
||||
List<ObjectRef<String>> waitList = ImmutableList.of(obj1, obj2);
|
||||
WaitResult<String> waitResult = Ray.wait(waitList, 2, 2 * 1000);
|
||||
@@ -53,7 +53,7 @@ public class WaitTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testWaitInWorker() {
|
||||
ObjectRef<Object> res = Ray.call(WaitTest::waitInWorker);
|
||||
ObjectRef<Object> res = Ray.task(WaitTest::waitInWorker).remote();
|
||||
res.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.ray.test;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -18,13 +17,12 @@ public class WorkerJvmOptionsTest extends BaseTest {
|
||||
@Test
|
||||
public void testJvmOptions() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorCreationOptions options = new ActorCreationOptions.Builder()
|
||||
// The whitespaces in following argument are intentionally added to test
|
||||
// that raylet can correctly handle dynamic options with whitespaces.
|
||||
// The whitespaces in following argument are intentionally added to test
|
||||
// that raylet can correctly handle dynamic options with whitespaces.
|
||||
ActorHandle<Echo> actor = Ray.actor(Echo::new)
|
||||
.setJvmOptions(" -Dtest.suffix=suffix -Dtest.suffix1=suffix1 ")
|
||||
.createActorCreationOptions();
|
||||
ActorHandle<Echo> actor = Ray.createActor(Echo::new, options);
|
||||
ObjectRef<String> obj = actor.call(Echo::getOptions);
|
||||
.remote();
|
||||
ObjectRef<String> obj = actor.task(Echo::getOptions).remote();
|
||||
Assert.assertEquals(obj.get(), "suffix");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public class Exercise01 implements Serializable {
|
||||
// Use `Ray.init` to initialize the Ray runtime.
|
||||
Ray.init();
|
||||
// Use `Ray.call` to call a remote function.
|
||||
ObjectRef<String> hello = Ray.call(Exercise01::sayHello);
|
||||
ObjectRef<String> world = Ray.call(Exercise01::sayWorld);
|
||||
ObjectRef<String> hello = Ray.task(Exercise01::sayHello).remote();
|
||||
ObjectRef<String> world = Ray.task(Exercise01::sayWorld).remote();
|
||||
System.out.println("First remote call result:" + hello.get());
|
||||
System.out.println("Second remote call result:" + world.get());
|
||||
} catch (Throwable t) {
|
||||
|
||||
@@ -28,10 +28,10 @@ public class Exercise02 {
|
||||
}
|
||||
|
||||
public static String sayHelloWorld() {
|
||||
ObjectRef<String> hello = Ray.call(Exercise02::sayHello);
|
||||
ObjectRef<String> world = Ray.call(Exercise02::sayWorld);
|
||||
ObjectRef<String> hello = Ray.task(Exercise02::sayHello).remote();
|
||||
ObjectRef<String> world = Ray.task(Exercise02::sayWorld).remote();
|
||||
// Pass unfinished results as the parameters to another remote function.
|
||||
return Ray.call(Exercise02::merge, hello, world).get();
|
||||
return Ray.task(Exercise02::merge, hello, world).remote().get();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Exercise03 {
|
||||
public static String sayHelloWithWorld() {
|
||||
String ret = "hello";
|
||||
System.out.println(ret);
|
||||
ObjectRef<String> world = Ray.call(Exercise03::sayWorld);
|
||||
ObjectRef<String> world = Ray.task(Exercise03::sayWorld).remote();
|
||||
return ret + "," + world.get();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Exercise03 {
|
||||
public static void main(String[] args) throws Exception {
|
||||
try {
|
||||
Ray.init();
|
||||
String helloWithWorld = Ray.call(Exercise03::sayHelloWithWorld).get();
|
||||
String helloWithWorld = Ray.task(Exercise03::sayHelloWithWorld).remote().get();
|
||||
System.out.println(helloWithWorld);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
||||
@@ -39,9 +39,9 @@ public class Exercise04 {
|
||||
try {
|
||||
Ray.init();
|
||||
List<ObjectRef<String>> waitList = ImmutableList.of(
|
||||
Ray.call(Exercise04::f1),
|
||||
Ray.call(Exercise04::f2),
|
||||
Ray.call(Exercise04::f3)
|
||||
Ray.task(Exercise04::f1).remote(),
|
||||
Ray.task(Exercise04::f2).remote(),
|
||||
Ray.task(Exercise04::f3).remote()
|
||||
);
|
||||
// Ray.wait will block until specified number of results are ready
|
||||
// or specified timeout have passed.
|
||||
|
||||
@@ -13,11 +13,11 @@ public class Exercise05 {
|
||||
try {
|
||||
Ray.init();
|
||||
// `Ray.createActor` creates an actor instance.
|
||||
ActorHandle<Adder> adder = Ray.createActor(Adder::new, 0);
|
||||
// Use `Ray.call(actor, parameters)` to call an actor method.
|
||||
ObjectRef<Integer> result1 = adder.call(Adder::add, 1);
|
||||
ActorHandle<Adder> adder = Ray.actor(Adder::new, 0).remote();
|
||||
// Use `Ray.task(actor, parameters).remote()` to call an actor method.
|
||||
ObjectRef<Integer> result1 = adder.task(Adder::add, 1).remote();
|
||||
System.out.println(result1.get());
|
||||
ObjectRef<Integer> result2 = adder.call(Adder::add, 10);
|
||||
ObjectRef<Integer> result2 = adder.task(Adder::add, 10).remote();
|
||||
System.out.println(result2.get());
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
||||
+6
-8
@@ -3,7 +3,6 @@ package io.ray.streaming.runtime.client;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import io.ray.streaming.client.JobClient;
|
||||
import io.ray.streaming.jobgraph.JobGraph;
|
||||
import io.ray.streaming.runtime.config.global.CommonConfig;
|
||||
@@ -27,10 +26,6 @@ public class JobClientImpl implements JobClient {
|
||||
LOG.info("Submitting job [{}] with job graph [{}] and job config [{}].",
|
||||
jobGraph.getJobName(), jobGraph, jobConfig);
|
||||
Map<String, Double> resources = new HashMap<>();
|
||||
ActorCreationOptions options = new ActorCreationOptions.Builder()
|
||||
.setResources(resources)
|
||||
.setMaxRestarts(-1)
|
||||
.createActorCreationOptions();
|
||||
|
||||
// set job name and id at start
|
||||
jobConfig.put(CommonConfig.JOB_ID, Ray.getRuntimeContext().getCurrentJobId().toString());
|
||||
@@ -39,11 +34,14 @@ public class JobClientImpl implements JobClient {
|
||||
jobGraph.getJobConfig().putAll(jobConfig);
|
||||
|
||||
// create job master actor
|
||||
this.jobMasterActor = Ray.createActor(JobMaster::new, jobConfig, options);
|
||||
this.jobMasterActor = Ray.actor(JobMaster::new, jobConfig)
|
||||
.setResources(resources)
|
||||
.setMaxRestarts(-1)
|
||||
.remote();
|
||||
|
||||
try {
|
||||
ObjectRef<Boolean> submitResult = jobMasterActor.call(JobMaster::submitJob,
|
||||
jobMasterActor, jobGraph);
|
||||
ObjectRef<Boolean> submitResult = jobMasterActor.task(JobMaster::submitJob,
|
||||
jobMasterActor, jobGraph).remote();
|
||||
|
||||
if (submitResult.get()) {
|
||||
LOG.info("Finish submitting job: {}.", jobGraph.getJobName());
|
||||
|
||||
+9
-9
@@ -6,7 +6,6 @@ import io.ray.api.Ray;
|
||||
import io.ray.api.WaitResult;
|
||||
import io.ray.api.function.PyActorClass;
|
||||
import io.ray.api.id.ActorId;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import io.ray.streaming.api.Language;
|
||||
import io.ray.streaming.runtime.core.graph.executiongraph.ExecutionGraph;
|
||||
import io.ray.streaming.runtime.core.graph.executiongraph.ExecutionVertex;
|
||||
@@ -46,17 +45,18 @@ public class WorkerLifecycleController {
|
||||
|
||||
Language language = executionVertex.getLanguage();
|
||||
|
||||
ActorCreationOptions options = new ActorCreationOptions.Builder()
|
||||
.setResources(executionVertex.getResource())
|
||||
.setMaxRestarts(-1)
|
||||
.createActorCreationOptions();
|
||||
|
||||
BaseActorHandle actor;
|
||||
if (Language.JAVA == language) {
|
||||
actor = Ray.createActor(JobWorker::new, options);
|
||||
actor = Ray.actor(JobWorker::new)
|
||||
.setResources(executionVertex.getResource())
|
||||
.setMaxRestarts(-1)
|
||||
.remote();
|
||||
} else {
|
||||
actor = Ray.createActor(
|
||||
new PyActorClass("ray.streaming.runtime.worker", "JobWorker"));
|
||||
actor = Ray.actor(new PyActorClass(
|
||||
"ray.streaming.runtime.worker", "JobWorker"))
|
||||
.setResources(executionVertex.getResource())
|
||||
.setMaxRestarts(-1)
|
||||
.remote();
|
||||
}
|
||||
|
||||
if (null == actor) {
|
||||
|
||||
+6
-5
@@ -32,11 +32,11 @@ public class RemoteCallWorker {
|
||||
|
||||
// python
|
||||
if (actor instanceof PyActorHandle) {
|
||||
result = ((PyActorHandle) actor).call(
|
||||
new PyActorMethod("init", Object.class), context.getPythonWorkerContextBytes());
|
||||
result = ((PyActorHandle) actor).task(new PyActorMethod("init", Object.class),
|
||||
context.getPythonWorkerContextBytes()).remote();
|
||||
} else {
|
||||
// java
|
||||
result = ((ActorHandle<JobWorker>) actor).call(JobWorker::init, context);
|
||||
result = ((ActorHandle<JobWorker>) actor).task(JobWorker::init, context).remote();
|
||||
}
|
||||
|
||||
LOG.info("Finished calling worker to initiate.");
|
||||
@@ -55,10 +55,11 @@ public class RemoteCallWorker {
|
||||
|
||||
// python
|
||||
if (actor instanceof PyActorHandle) {
|
||||
result = ((PyActorHandle) actor).call(new PyActorMethod("start", Object.class));
|
||||
result = ((PyActorHandle) actor)
|
||||
.task(new PyActorMethod("start", Object.class)).remote();
|
||||
} else {
|
||||
// java
|
||||
result = ((ActorHandle<JobWorker>) actor).call(JobWorker::start);
|
||||
result = ((ActorHandle<JobWorker>) actor).task(JobWorker::start).remote();
|
||||
}
|
||||
|
||||
LOG.info("Finished calling worker to start.");
|
||||
|
||||
+9
-16
@@ -3,8 +3,6 @@ package io.ray.streaming.runtime.streamingqueue;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import io.ray.api.options.ActorCreationOptions.Builder;
|
||||
import io.ray.runtime.config.RayConfig;
|
||||
import io.ray.streaming.api.context.StreamingContext;
|
||||
import io.ray.streaming.api.function.impl.FlatMapFunction;
|
||||
@@ -30,7 +28,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -89,19 +86,15 @@ public class StreamingQueueTest extends BaseUnitTest implements Serializable {
|
||||
// ray init
|
||||
Ray.init();
|
||||
|
||||
ActorCreationOptions.Builder builder = new Builder();
|
||||
|
||||
ActorHandle<WriterWorker> writerActor = Ray.createActor(WriterWorker::new, "writer",
|
||||
builder.createActorCreationOptions());
|
||||
ActorHandle<ReaderWorker> readerActor = Ray.createActor(ReaderWorker::new, "reader",
|
||||
builder.createActorCreationOptions());
|
||||
ActorHandle<WriterWorker> writerActor = Ray.actor(WriterWorker::new, "writer").remote();
|
||||
ActorHandle<ReaderWorker> readerActor = Ray.actor(ReaderWorker::new, "reader").remote();
|
||||
|
||||
LOGGER.info("call getName on writerActor: {}",
|
||||
writerActor.call(WriterWorker::getName).get());
|
||||
writerActor.task(WriterWorker::getName).remote().get());
|
||||
LOGGER.info("call getName on readerActor: {}",
|
||||
readerActor.call(ReaderWorker::getName).get());
|
||||
readerActor.task(ReaderWorker::getName).remote().get());
|
||||
|
||||
// LOGGER.info(writerActor.call(WriterWorker::testCallReader, readerActor).get());
|
||||
// LOGGER.info(writerActor.task(WriterWorker::testCallReader, readerActor).remote().get());
|
||||
List<String> outputQueueList = new ArrayList<>();
|
||||
List<String> inputQueueList = new ArrayList<>();
|
||||
int queueNum = 2;
|
||||
@@ -114,17 +107,17 @@ public class StreamingQueueTest extends BaseUnitTest implements Serializable {
|
||||
}
|
||||
|
||||
final int msgCount = 100;
|
||||
readerActor.call(ReaderWorker::init, inputQueueList, writerActor, msgCount);
|
||||
readerActor.task(ReaderWorker::init, inputQueueList, writerActor, msgCount).remote();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
writerActor.call(WriterWorker::init, outputQueueList, readerActor, msgCount);
|
||||
writerActor.task(WriterWorker::init, outputQueueList, readerActor, msgCount).remote();
|
||||
|
||||
long time = 0;
|
||||
while (time < 20000 &&
|
||||
readerActor.call(ReaderWorker::getTotalMsg).get() < msgCount * queueNum) {
|
||||
readerActor.task(ReaderWorker::getTotalMsg).remote().get() < msgCount * queueNum) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
time += 1000;
|
||||
@@ -134,7 +127,7 @@ public class StreamingQueueTest extends BaseUnitTest implements Serializable {
|
||||
}
|
||||
|
||||
Assert.assertEquals(
|
||||
readerActor.call(ReaderWorker::getTotalMsg).get().intValue(),
|
||||
readerActor.task(ReaderWorker::getTotalMsg).remote().get().intValue(),
|
||||
msgCount * queueNum);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ class WriterWorker extends Worker {
|
||||
}
|
||||
|
||||
public String testCallReader(ActorHandle<ReaderWorker> readerActor) {
|
||||
String name = readerActor.call(ReaderWorker::getName).get();
|
||||
String name = readerActor.task(ReaderWorker::getName).remote().get();
|
||||
LOGGER.info("testCallReader: {}", name);
|
||||
return name;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ class WriterWorker extends Worker {
|
||||
|
||||
int count = 3;
|
||||
while (count-- != 0) {
|
||||
peer.call(ReaderWorker::testRayCall).get();
|
||||
peer.task(ReaderWorker::testRayCall).remote().get();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user