mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[Java] New Java actor API (#7414)
This commit is contained in:
parent
4198db5038
commit
fe7820fec9
46 changed files with 1576 additions and 753 deletions
654
java/api/src/main/java/org/ray/api/ActorCall.java
Normal file
654
java/api/src/main/java/org/ray/api/ActorCall.java
Normal file
|
@ -0,0 +1,654 @@
|
||||||
|
// Generated by `RayCallGenerator.java`. DO NOT EDIT.
|
||||||
|
|
||||||
|
package org.ray.api;
|
||||||
|
|
||||||
|
import org.ray.api.function.RayFunc1;
|
||||||
|
import org.ray.api.function.RayFunc2;
|
||||||
|
import org.ray.api.function.RayFunc3;
|
||||||
|
import org.ray.api.function.RayFunc4;
|
||||||
|
import org.ray.api.function.RayFunc5;
|
||||||
|
import org.ray.api.function.RayFunc6;
|
||||||
|
import org.ray.api.function.RayFuncVoid1;
|
||||||
|
import org.ray.api.function.RayFuncVoid2;
|
||||||
|
import org.ray.api.function.RayFuncVoid3;
|
||||||
|
import org.ray.api.function.RayFuncVoid4;
|
||||||
|
import org.ray.api.function.RayFuncVoid5;
|
||||||
|
import org.ray.api.function.RayFuncVoid6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides type-safe interfaces for remote actor calls.
|
||||||
|
**/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
interface ActorCall<A> {
|
||||||
|
|
||||||
|
default <R> RayObject<R> call(RayFunc1<A, R> f) {
|
||||||
|
Object[] args = new Object[]{};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default void call(RayFuncVoid1<A> f) {
|
||||||
|
Object[] args = new Object[]{};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, R> RayObject<R> call(RayFunc2<A, T0, R> f, T0 t0) {
|
||||||
|
Object[] args = new Object[]{t0};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, R> RayObject<R> call(RayFunc2<A, T0, R> f, RayObject<T0> t0) {
|
||||||
|
Object[] args = new Object[]{t0};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0> void call(RayFuncVoid2<A, T0> f, T0 t0) {
|
||||||
|
Object[] args = new Object[]{t0};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0> void call(RayFuncVoid2<A, T0> f, RayObject<T0> t0) {
|
||||||
|
Object[] args = new Object[]{t0};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, R> RayObject<R> call(RayFunc3<A, T0, T1, R> f, T0 t0, T1 t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, R> RayObject<R> call(RayFunc3<A, T0, T1, R> f, T0 t0, RayObject<T1> t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, R> RayObject<R> call(RayFunc3<A, T0, T1, R> f, RayObject<T0> t0, T1 t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, R> RayObject<R> call(RayFunc3<A, T0, T1, R> f, RayObject<T0> t0, RayObject<T1> t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, T0 t0, T1 t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, T0 t0, RayObject<T1> t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, RayObject<T0> t0, T1 t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1> void call(RayFuncVoid3<A, T0, T1> f, RayObject<T0> t0, RayObject<T1> t1) {
|
||||||
|
Object[] args = new Object[]{t0, t1};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, T1 t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, RayObject<T1> t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, RayObject<T0> t0, T1 t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, R> RayObject<R> call(RayFunc4<A, T0, T1, T2, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, T1 t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, RayObject<T1> t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, RayObject<T0> t0, T1 t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2> void call(RayFuncVoid4<A, T0, T1, T2> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(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(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, RayObject<T1> t1, T2 t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, T1 t1, T2 t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, T1 t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, R> RayObject<R> call(RayFunc5<A, T0, T1, T2, T3, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(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(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, RayObject<T1> t1, T2 t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, T1 t1, T2 t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, T1 t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3> void call(RayFuncVoid5<A, T0, T1, T2, T3> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(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(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4, R> RayObject<R> call(RayFunc6<A, T0, T1, T2, T3, T4, R> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
return Ray.internal().callActor(f, (RayActor) this, 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) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, 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, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, T0 t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, T2 t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, T1 t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, T2 t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, T3 t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, T4 t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
default <T0, T1, T2, T3, T4> void call(RayFuncVoid6<A, T0, T1, T2, T3, T4> f, RayObject<T0> t0, RayObject<T1> t1, RayObject<T2> t2, RayObject<T3> t3, RayObject<T4> t4) {
|
||||||
|
Object[] args = new Object[]{t0, t1, t2, t3, t4};
|
||||||
|
Ray.internal().callActor(f, (RayActor) this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,14 +3,34 @@ package org.ray.api;
|
||||||
import org.ray.api.id.ActorId;
|
import org.ray.api.id.ActorId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A handle to an actor.
|
* A handle to an actor. <p>
|
||||||
*
|
*
|
||||||
* @param <T> The type of the concrete actor class.
|
* A handle can be used to invoke a remote actor method, with the {@code "call"} method. For
|
||||||
|
* example:
|
||||||
|
* <pre> {@code
|
||||||
|
* class MyActor {
|
||||||
|
* public int echo(int x) {
|
||||||
|
* return x;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* // Create an actor, and get a handle.
|
||||||
|
* RayActor<MyActor> myActor = Ray.createActor(RayActor::new);
|
||||||
|
* // Call the `echo` method remotely.
|
||||||
|
* RayObject<Integer> result = myActor.call(MyActor::echo, 1);
|
||||||
|
* // Get the result of the remote `echo` method.
|
||||||
|
* Assert.assertEqual(result.get(), 1);
|
||||||
|
* }</pre>
|
||||||
|
*
|
||||||
|
* Note, the {@code "call"} method is defined in {@link ActorCall} interface, with multiple
|
||||||
|
* overloaded versions.
|
||||||
|
*
|
||||||
|
* @param <A> The type of the concrete actor class.
|
||||||
*/
|
*/
|
||||||
public interface RayActor<T> {
|
public interface RayActor<A> extends ActorCall<A> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The id of this actor.
|
* @return The id of this actor.
|
||||||
*/
|
*/
|
||||||
ActorId getId();
|
ActorId getId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,18 +0,0 @@
|
||||||
package org.ray.api.annotation;
|
|
||||||
|
|
||||||
import java.lang.annotation.Documented;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines a remote function (when used on a method),
|
|
||||||
* or an actor (when used on a class).
|
|
||||||
*/
|
|
||||||
@Documented
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
|
||||||
public @interface RayRemote {
|
|
||||||
|
|
||||||
}
|
|
|
@ -101,7 +101,7 @@ public interface RayRuntime {
|
||||||
* @param args The arguments of the remote function.
|
* @param args The arguments of the remote function.
|
||||||
* @return The result object.
|
* @return The result object.
|
||||||
*/
|
*/
|
||||||
RayObject call(RayFunc func, RayActor<?> actor, Object[] args);
|
RayObject callActor(RayFunc func, RayActor<?> actor, Object[] args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an actor on a remote node.
|
* Create an actor on a remote node.
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<suppress checks="NoFinalizer" files="NativeRayActor.java"/>
|
<suppress checks="NoFinalizer" files="NativeRayActor.java"/>
|
||||||
<suppress checks="AbbreviationAsWordInNameCheck" files="RayParameters.java"/>
|
<suppress checks="AbbreviationAsWordInNameCheck" files="RayParameters.java"/>
|
||||||
<suppress checks=".*" files="RayCall.java"/>
|
<suppress checks=".*" files="RayCall.java"/>
|
||||||
|
<suppress checks=".*" files="ActorCall.java"/>
|
||||||
<!-- suppress check for flatbuffer-generated files. -->
|
<!-- suppress check for flatbuffer-generated files. -->
|
||||||
<suppress checks=".*" files="org[\\/]ray[\\/]runtime[\\/]generated[\\/]" />
|
<suppress checks=".*" files="org[\\/]ray[\\/]runtime[\\/]generated[\\/]" />
|
||||||
</suppressions>
|
</suppressions>
|
||||||
|
|
|
@ -98,7 +98,7 @@ public abstract class AbstractRayRuntime implements RayRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayObject call(RayFunc func, RayActor<?> actor, Object[] args) {
|
public RayObject callActor(RayFunc func, RayActor<?> actor, Object[] args) {
|
||||||
FunctionDescriptor functionDescriptor =
|
FunctionDescriptor functionDescriptor =
|
||||||
functionManager.getFunction(workerContext.getCurrentJobId(), func)
|
functionManager.getFunction(workerContext.getCurrentJobId(), func)
|
||||||
.functionDescriptor;
|
.functionDescriptor;
|
||||||
|
|
|
@ -149,8 +149,8 @@ public class RayMultiWorkerNativeRuntime implements RayRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayObject call(RayFunc func, RayActor<?> actor, Object[] args) {
|
public RayObject callActor(RayFunc func, RayActor<?> actor, Object[] args) {
|
||||||
return getCurrentRuntime().call(func, actor, args);
|
return getCurrentRuntime().callActor(func, actor, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.runtime.functionmanager;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Executable;
|
import java.lang.reflect.Executable;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a Ray function (either a Method or a Constructor in Java) and its metadata.
|
* Represents a Ray function (either a Method or a Constructor in Java) and its metadata.
|
||||||
|
@ -57,21 +56,6 @@ public class RayFunction {
|
||||||
return functionDescriptor;
|
return functionDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RayRemote getRayRemoteAnnotation() {
|
|
||||||
RayRemote rayRemote;
|
|
||||||
|
|
||||||
// If this method is a constructor, the task of it should be a actorCreationTask.
|
|
||||||
// And the annotation of actorCreationTask should inherit from class.
|
|
||||||
// Otherwise, it's a normal method, and it shouldn't inherit annotation from class.
|
|
||||||
if (isConstructor()) {
|
|
||||||
rayRemote = executable.getDeclaringClass().getAnnotation(RayRemote.class);
|
|
||||||
} else {
|
|
||||||
rayRemote = executable.getAnnotation(RayRemote.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rayRemote;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether this function has a return value.
|
* @return Whether this function has a return value.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,18 +8,18 @@ import java.util.List;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A util class that generates `RayCall.java`, which provides type-safe interfaces for `Ray.call`
|
* A util class that generates `RayCall.java` and `ActorCall.java`, which provide type-safe
|
||||||
* and `Ray.createActor`.
|
* interfaces for `Ray.call`, `Ray.createActor` and `actor.call`.
|
||||||
*/
|
*/
|
||||||
public class RayCallGenerator extends BaseGenerator {
|
public class RayCallGenerator extends BaseGenerator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whole file content of `RayCall.java`.
|
* @return Whole file content of `RayCall.java`.
|
||||||
*/
|
*/
|
||||||
private String build() {
|
private String generateRayCallDotJava() {
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
|
|
||||||
newLine("// generated automatically, do not modify.");
|
newLine("// Generated by `RayCallGenerator.java`. DO NOT EDIT.");
|
||||||
newLine("");
|
newLine("");
|
||||||
newLine("package org.ray.api;");
|
newLine("package org.ray.api;");
|
||||||
newLine("");
|
newLine("");
|
||||||
|
@ -48,13 +48,6 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
buildCalls(i, false, false, false, true);
|
buildCalls(i, false, false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
newLine(1, "// ===========================================");
|
|
||||||
newLine(1, "// Methods for remote actor method invocation.");
|
|
||||||
newLine(1, "// ===========================================");
|
|
||||||
for (int i = 0; i <= MAX_PARAMETERS - 1; i++) {
|
|
||||||
buildCalls(i, true, false, true, false);
|
|
||||||
buildCalls(i, true, false, false, false);
|
|
||||||
}
|
|
||||||
newLine(1, "// ===========================");
|
newLine(1, "// ===========================");
|
||||||
newLine(1, "// Methods for actor creation.");
|
newLine(1, "// Methods for actor creation.");
|
||||||
newLine(1, "// ===========================");
|
newLine(1, "// ===========================");
|
||||||
|
@ -70,6 +63,7 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
buildPyCalls(i, false, false, false);
|
buildPyCalls(i, false, false, false);
|
||||||
buildPyCalls(i, false, false, true);
|
buildPyCalls(i, false, false, true);
|
||||||
}
|
}
|
||||||
|
// TODO(hchen): move Python actor call API to `RayPyActor` class.
|
||||||
for (int i = 0; i <= MAX_PARAMETERS - 1; i++) {
|
for (int i = 0; i <= MAX_PARAMETERS - 1; i++) {
|
||||||
buildPyCalls(i, true, false, false);
|
buildPyCalls(i, true, false, false);
|
||||||
}
|
}
|
||||||
|
@ -82,30 +76,61 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the `Ray.call` or `Ray.createActor` methods with the given number of parameters.
|
* @return Whole file content of `ActorCall.java`.
|
||||||
|
*/
|
||||||
|
private String generateActorCallDotJava() {
|
||||||
|
sb = new StringBuilder();
|
||||||
|
|
||||||
|
newLine("// Generated by `RayCallGenerator.java`. DO NOT EDIT.");
|
||||||
|
newLine("");
|
||||||
|
newLine("package org.ray.api;");
|
||||||
|
newLine("");
|
||||||
|
for (int i = 1; i <= MAX_PARAMETERS; i++) {
|
||||||
|
newLine("import org.ray.api.function.RayFunc" + i + ";");
|
||||||
|
}
|
||||||
|
for (int i = 1; i <= MAX_PARAMETERS; i++) {
|
||||||
|
newLine("import org.ray.api.function.RayFuncVoid" + i + ";");
|
||||||
|
}
|
||||||
|
newLine("");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
newLine("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build `Ray.call`, `Ray.createActor` and `actor.call` methods with
|
||||||
|
* the given number of parameters.
|
||||||
*
|
*
|
||||||
* @param numParameters the number of parameters
|
* @param numParameters the number of parameters
|
||||||
* @param forActor build actor api when true, otherwise build task api.
|
* @param forActor Build `actor.call` when true, otherwise build `Ray.call`.
|
||||||
* @param hasReturn if true, build api for functions with return.
|
* @param hasReturn if true, Build api for functions with return.
|
||||||
* @param forActorCreation build `Ray.createActor` when true, otherwise build `Ray.call`.
|
* @param forActorCreation Build `Ray.createActor` when true, otherwise build `Ray.call`.
|
||||||
*/
|
*/
|
||||||
private void buildCalls(int numParameters, boolean forActor,
|
private void buildCalls(int numParameters, boolean forActor,
|
||||||
boolean forActorCreation, boolean hasReturn, boolean hasOptionsParam) {
|
boolean forActorCreation, boolean hasReturn, boolean hasOptionsParam) {
|
||||||
// Template of the generated function:
|
// Template of the generated function:
|
||||||
// public static [genericTypes] [returnType] [callFunc]([argsDeclaration]) {
|
// [modifiers] [genericTypes] [returnType] [callFunc]([argsDeclaration]) {
|
||||||
// Objects[] args = new Object[]{[args]};
|
// Objects[] args = new Object[]{[args]};
|
||||||
// return Ray.internal().[callFunc](f[, actor], args[, options]);
|
// return Ray.internal().[callFunc](f[, getThis()], args[, options]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
String modifiers = forActor ? "default" : "public static";
|
||||||
|
|
||||||
// 1) Construct the `genericTypes` part, e.g. `<T0, T1, T2, R>`.
|
// 1) Construct the `genericTypes` part, e.g. `<T0, T1, T2, R>`.
|
||||||
String genericTypes = "";
|
String genericTypes = "";
|
||||||
for (int i = 0; i < numParameters; i++) {
|
for (int i = 0; i < numParameters; i++) {
|
||||||
genericTypes += "T" + i + ", ";
|
genericTypes += "T" + i + ", ";
|
||||||
}
|
}
|
||||||
if (forActor) {
|
|
||||||
// Actor generic type.
|
|
||||||
genericTypes = "A, " + genericTypes;
|
|
||||||
}
|
|
||||||
// Return generic type.
|
// Return generic type.
|
||||||
if (forActorCreation) {
|
if (forActorCreation) {
|
||||||
genericTypes += "A, ";
|
genericTypes += "A, ";
|
||||||
|
@ -129,15 +154,21 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) Construct the `argsDeclaration` part.
|
// 3) Construct the `argsDeclaration` part.
|
||||||
|
String rayFuncGenericTypes = genericTypes;
|
||||||
|
if (forActor) {
|
||||||
|
if (rayFuncGenericTypes.isEmpty()) {
|
||||||
|
rayFuncGenericTypes = "<A>";
|
||||||
|
} else {
|
||||||
|
rayFuncGenericTypes = rayFuncGenericTypes.replace("<", "<A, ");
|
||||||
|
}
|
||||||
|
}
|
||||||
String argsDeclarationPrefix = String.format("RayFunc%s%d%s f, ",
|
String argsDeclarationPrefix = String.format("RayFunc%s%d%s f, ",
|
||||||
hasReturn ? "" : "Void",
|
hasReturn ? "" : "Void",
|
||||||
!forActor ? numParameters : numParameters + 1,
|
!forActor ? numParameters : numParameters + 1,
|
||||||
genericTypes);
|
rayFuncGenericTypes);
|
||||||
if (forActor) {
|
|
||||||
argsDeclarationPrefix += "RayActor<A> actor, ";
|
|
||||||
}
|
|
||||||
|
|
||||||
String callFunc = forActorCreation ? "createActor" : "call";
|
String callFunc = forActorCreation ? "createActor" : "call";
|
||||||
|
String internalCallFunc = forActorCreation ? "createActor" : forActor ? "callActor" : "call";
|
||||||
|
|
||||||
// Enumerate all combinations of the parameters.
|
// Enumerate all combinations of the parameters.
|
||||||
for (String param : generateParameters(numParameters)) {
|
for (String param : generateParameters(numParameters)) {
|
||||||
|
@ -150,7 +181,7 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
argsDeclaration = argsDeclaration.substring(0, argsDeclaration.length() - 2);
|
argsDeclaration = argsDeclaration.substring(0, argsDeclaration.length() - 2);
|
||||||
// Print the first line (method signature).
|
// Print the first line (method signature).
|
||||||
newLine(1, String.format(
|
newLine(1, String.format(
|
||||||
"public static%s %s %s(%s) {",
|
"%s%s %s %s(%s) {", modifiers,
|
||||||
genericTypes.isEmpty() ? "" : " " + genericTypes, returnType, callFunc, argsDeclaration
|
genericTypes.isEmpty() ? "" : " " + genericTypes, returnType, callFunc, argsDeclaration
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -169,22 +200,23 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
// 5) Construct the third line.
|
// 5) Construct the third line.
|
||||||
String callFuncArgs = "f, ";
|
String callFuncArgs = "f, ";
|
||||||
if (forActor) {
|
if (forActor) {
|
||||||
callFuncArgs += "actor, ";
|
callFuncArgs += "(RayActor) this, ";
|
||||||
}
|
}
|
||||||
callFuncArgs += "args, ";
|
callFuncArgs += "args, ";
|
||||||
callFuncArgs += forActor ? "" : hasOptionsParam ? "options, " : "null, ";
|
callFuncArgs += forActor ? "" : hasOptionsParam ? "options, " : "null, ";
|
||||||
callFuncArgs = callFuncArgs.substring(0, callFuncArgs.length() - 2);
|
callFuncArgs = callFuncArgs.substring(0, callFuncArgs.length() - 2);
|
||||||
newLine(2, String.format("%sRay.internal().%s(%s);",
|
newLine(2, String.format("%sRay.internal().%s(%s);",
|
||||||
hasReturn ? "return " : "", callFunc, callFuncArgs));
|
hasReturn ? "return " : "", internalCallFunc, callFuncArgs));
|
||||||
newLine(1, "}");
|
newLine(1, "}");
|
||||||
|
newLine("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the `Ray.callPy` or `Ray.createPyActor` methods.
|
* Build the `Ray.callPy` or `Ray.createPyActor` methods.
|
||||||
*
|
*
|
||||||
* @param forActor build actor api when true, otherwise build task api.
|
* @param forActor Build actor api when true, otherwise build task api.
|
||||||
* @param forActorCreation build `Ray.createPyActor` when true, otherwise build `Ray.callPy`.
|
* @param forActorCreation Build `Ray.createPyActor` when true, otherwise build `Ray.callPy`.
|
||||||
*/
|
*/
|
||||||
private void buildPyCalls(int numParameters, boolean forActor,
|
private void buildPyCalls(int numParameters, boolean forActor,
|
||||||
boolean forActorCreation, boolean hasOptionsParam) {
|
boolean forActorCreation, boolean hasOptionsParam) {
|
||||||
|
@ -269,7 +301,12 @@ public class RayCallGenerator extends BaseGenerator {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
String path = System.getProperty("user.dir")
|
String path = System.getProperty("user.dir")
|
||||||
+ "/api/src/main/java/org/ray/api/RayCall.java";
|
+ "/api/src/main/java/org/ray/api/RayCall.java";
|
||||||
FileUtils.write(new File(path), new RayCallGenerator().build(), Charset.defaultCharset());
|
FileUtils.write(new File(path), new RayCallGenerator().generateRayCallDotJava(),
|
||||||
|
Charset.defaultCharset());
|
||||||
|
path = System.getProperty("user.dir")
|
||||||
|
+ "/api/src/main/java/org/ray/api/ActorCall.java";
|
||||||
|
FileUtils.write(new File(path), new RayCallGenerator().generateActorCallDotJava(),
|
||||||
|
Charset.defaultCharset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import javax.tools.ToolProvider;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.function.RayFunc0;
|
import org.ray.api.function.RayFunc0;
|
||||||
import org.ray.api.function.RayFunc1;
|
import org.ray.api.function.RayFunc1;
|
||||||
import org.ray.api.id.JobId;
|
import org.ray.api.id.JobId;
|
||||||
|
@ -23,12 +22,10 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
public class FunctionManagerTest {
|
public class FunctionManagerTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static Object foo() {
|
public static Object foo() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class Bar {
|
public static class Bar {
|
||||||
|
|
||||||
public Bar() {
|
public Bar() {
|
||||||
|
@ -81,19 +78,16 @@ public class FunctionManagerTest {
|
||||||
RayFunction func = functionManager.getFunction(JobId.NIL, fooFunc);
|
RayFunction func = functionManager.getFunction(JobId.NIL, fooFunc);
|
||||||
Assert.assertFalse(func.isConstructor());
|
Assert.assertFalse(func.isConstructor());
|
||||||
Assert.assertEquals(func.getFunctionDescriptor(), fooDescriptor);
|
Assert.assertEquals(func.getFunctionDescriptor(), fooDescriptor);
|
||||||
Assert.assertNotNull(func.getRayRemoteAnnotation());
|
|
||||||
|
|
||||||
// Test actor method
|
// Test actor method
|
||||||
func = functionManager.getFunction(JobId.NIL, barFunc);
|
func = functionManager.getFunction(JobId.NIL, barFunc);
|
||||||
Assert.assertFalse(func.isConstructor());
|
Assert.assertFalse(func.isConstructor());
|
||||||
Assert.assertEquals(func.getFunctionDescriptor(), barDescriptor);
|
Assert.assertEquals(func.getFunctionDescriptor(), barDescriptor);
|
||||||
Assert.assertNull(func.getRayRemoteAnnotation());
|
|
||||||
|
|
||||||
// Test actor constructor
|
// Test actor constructor
|
||||||
func = functionManager.getFunction(JobId.NIL, barConstructor);
|
func = functionManager.getFunction(JobId.NIL, barConstructor);
|
||||||
Assert.assertTrue(func.isConstructor());
|
Assert.assertTrue(func.isConstructor());
|
||||||
Assert.assertEquals(func.getFunctionDescriptor(), barConstructorDescriptor);
|
Assert.assertEquals(func.getFunctionDescriptor(), barConstructorDescriptor);
|
||||||
Assert.assertNotNull(func.getRayRemoteAnnotation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -103,19 +97,16 @@ public class FunctionManagerTest {
|
||||||
RayFunction func = functionManager.getFunction(JobId.NIL, fooDescriptor);
|
RayFunction func = functionManager.getFunction(JobId.NIL, fooDescriptor);
|
||||||
Assert.assertFalse(func.isConstructor());
|
Assert.assertFalse(func.isConstructor());
|
||||||
Assert.assertEquals(func.getFunctionDescriptor(), fooDescriptor);
|
Assert.assertEquals(func.getFunctionDescriptor(), fooDescriptor);
|
||||||
Assert.assertNotNull(func.getRayRemoteAnnotation());
|
|
||||||
|
|
||||||
// Test actor method
|
// Test actor method
|
||||||
func = functionManager.getFunction(JobId.NIL, barDescriptor);
|
func = functionManager.getFunction(JobId.NIL, barDescriptor);
|
||||||
Assert.assertFalse(func.isConstructor());
|
Assert.assertFalse(func.isConstructor());
|
||||||
Assert.assertEquals(func.getFunctionDescriptor(), barDescriptor);
|
Assert.assertEquals(func.getFunctionDescriptor(), barDescriptor);
|
||||||
Assert.assertNull(func.getRayRemoteAnnotation());
|
|
||||||
|
|
||||||
// Test actor constructor
|
// Test actor constructor
|
||||||
func = functionManager.getFunction(JobId.NIL, barConstructorDescriptor);
|
func = functionManager.getFunction(JobId.NIL, barConstructorDescriptor);
|
||||||
Assert.assertTrue(func.isConstructor());
|
Assert.assertTrue(func.isConstructor());
|
||||||
Assert.assertEquals(func.getFunctionDescriptor(), barConstructorDescriptor);
|
Assert.assertEquals(func.getFunctionDescriptor(), barConstructorDescriptor);
|
||||||
Assert.assertNotNull(func.getRayRemoteAnnotation());
|
|
||||||
|
|
||||||
// Test raise overload exception
|
// Test raise overload exception
|
||||||
Assert.expectThrows(RuntimeException.class, () -> {
|
Assert.expectThrows(RuntimeException.class, () -> {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.api;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.options.ActorCreationOptions;
|
import org.ray.api.options.ActorCreationOptions;
|
||||||
import org.ray.api.runtime.RayRuntime;
|
import org.ray.api.runtime.RayRuntime;
|
||||||
import org.ray.runtime.AbstractRayRuntime;
|
import org.ray.runtime.AbstractRayRuntime;
|
||||||
|
@ -79,7 +78,6 @@ public class TestUtils {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String hi() {
|
private static String hi() {
|
||||||
return "hi";
|
return "hi";
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.api.benchmark;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class ActorPressTest extends RayBenchmarkTest {
|
public class ActorPressTest extends RayBenchmarkTest {
|
||||||
|
@ -45,7 +44,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayObject<RemoteResult<Integer>> rayCall(RayActor rayActor) {
|
public RayObject<RemoteResult<Integer>> rayCall(RayActor rayActor) {
|
||||||
return Ray.call(Adder::add, (RayActor<Adder>) rayActor, 10);
|
return ((RayActor<Adder>) rayActor).call(Adder::add, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,7 +52,6 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class Adder {
|
public static class Adder {
|
||||||
|
|
||||||
private Integer sum = 0;
|
private Integer sum = 0;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.api.benchmark;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class MaxPressureTest extends RayBenchmarkTest {
|
public class MaxPressureTest extends RayBenchmarkTest {
|
||||||
|
@ -12,7 +11,6 @@ public class MaxPressureTest extends RayBenchmarkTest {
|
||||||
public static final int totalNum = 10;
|
public static final int totalNum = 10;
|
||||||
private static final long serialVersionUID = -1684518885171395952L;
|
private static final long serialVersionUID = -1684518885171395952L;
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static RemoteResult<Integer> currentTime() {
|
public static RemoteResult<Integer> currentTime() {
|
||||||
RemoteResult<Integer> remoteResult = new RemoteResult<>();
|
RemoteResult<Integer> remoteResult = new RemoteResult<>();
|
||||||
remoteResult.setFinishTime(System.nanoTime());
|
remoteResult.setFinishTime(System.nanoTime());
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.api.benchmark;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class RateLimiterPressureTest extends RayBenchmarkTest {
|
public class RateLimiterPressureTest extends RayBenchmarkTest {
|
||||||
|
@ -13,7 +12,6 @@ public class RateLimiterPressureTest extends RayBenchmarkTest {
|
||||||
public static final int duration = 10;
|
public static final int duration = 10;
|
||||||
private static final long serialVersionUID = 6616958120966144235L;
|
private static final long serialVersionUID = 6616958120966144235L;
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static RemoteResult<Integer> currentTime() {
|
public static RemoteResult<Integer> currentTime() {
|
||||||
RemoteResult<Integer> remoteResult = new RemoteResult<>();
|
RemoteResult<Integer> remoteResult = new RemoteResult<>();
|
||||||
remoteResult.setFinishTime(System.nanoTime());
|
remoteResult.setFinishTime(System.nanoTime());
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.function.RayFunc1;
|
import org.ray.api.function.RayFunc1;
|
||||||
import org.ray.api.test.BaseTest;
|
import org.ray.api.test.BaseTest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -23,7 +22,6 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||||
public static final DecimalFormat df = new DecimalFormat("00.00");
|
public static final DecimalFormat df = new DecimalFormat("00.00");
|
||||||
private static final long serialVersionUID = 416045641835782523L;
|
private static final long serialVersionUID = 416045641835782523L;
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static List<Long> singleClient(PressureTestParameter pressureTestParameter) {
|
private static List<Long> singleClient(PressureTestParameter pressureTestParameter) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.api.benchmark;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class SingleLatencyTest extends RayBenchmarkTest {
|
public class SingleLatencyTest extends RayBenchmarkTest {
|
||||||
|
@ -11,7 +10,6 @@ public class SingleLatencyTest extends RayBenchmarkTest {
|
||||||
public static final int totalNum = 10;
|
public static final int totalNum = 10;
|
||||||
private static final long serialVersionUID = 3559601273941694468L;
|
private static final long serialVersionUID = 3559601273941694468L;
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static RemoteResult<Integer> doFunc() {
|
public static RemoteResult<Integer> doFunc() {
|
||||||
RemoteResult<Integer> remoteResult = new RemoteResult<>();
|
RemoteResult<Integer> remoteResult = new RemoteResult<>();
|
||||||
remoteResult.setResult(1);
|
remoteResult.setResult(1);
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.options.ActorCreationOptions;
|
import org.ray.api.options.ActorCreationOptions;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -16,7 +15,6 @@ import org.testng.annotations.Test;
|
||||||
@Test
|
@Test
|
||||||
public class ActorConcurrentCallTest extends BaseTest {
|
public class ActorConcurrentCallTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class ConcurrentActor {
|
public static class ConcurrentActor {
|
||||||
private final CountDownLatch countDownLatch = new CountDownLatch(3);
|
private final CountDownLatch countDownLatch = new CountDownLatch(3);
|
||||||
|
|
||||||
|
@ -38,9 +36,9 @@ public class ActorConcurrentCallTest extends BaseTest {
|
||||||
.setMaxConcurrency(3)
|
.setMaxConcurrency(3)
|
||||||
.createActorCreationOptions();
|
.createActorCreationOptions();
|
||||||
RayActor<ConcurrentActor> actor = Ray.createActor(ConcurrentActor::new, op);
|
RayActor<ConcurrentActor> actor = Ray.createActor(ConcurrentActor::new, op);
|
||||||
RayObject<String> obj1 = Ray.call(ConcurrentActor::countDown, actor);
|
RayObject<String> obj1 = actor.call(ConcurrentActor::countDown);
|
||||||
RayObject<String> obj2 = Ray.call(ConcurrentActor::countDown, actor);
|
RayObject<String> obj2 = actor.call(ConcurrentActor::countDown);
|
||||||
RayObject<String> obj3 = Ray.call(ConcurrentActor::countDown, actor);
|
RayObject<String> obj3 = actor.call(ConcurrentActor::countDown);
|
||||||
|
|
||||||
List<Integer> expectedResult = ImmutableList.of(1, 2, 3);
|
List<Integer> expectedResult = ImmutableList.of(1, 2, 3);
|
||||||
Assert.assertEquals(obj1.get(), "ok");
|
Assert.assertEquals(obj1.get(), "ok");
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.ray.api.Checkpointable;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.exception.RayActorException;
|
import org.ray.api.exception.RayActorException;
|
||||||
import org.ray.api.id.ActorId;
|
import org.ray.api.id.ActorId;
|
||||||
import org.ray.api.id.UniqueId;
|
import org.ray.api.id.UniqueId;
|
||||||
|
@ -20,7 +19,6 @@ import org.testng.annotations.Test;
|
||||||
@Test
|
@Test
|
||||||
public class ActorReconstructionTest extends BaseTest {
|
public class ActorReconstructionTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote()
|
|
||||||
public static class Counter {
|
public static class Counter {
|
||||||
|
|
||||||
protected int value = 0;
|
protected int value = 0;
|
||||||
|
@ -52,31 +50,31 @@ public class ActorReconstructionTest extends BaseTest {
|
||||||
RayActor<Counter> actor = Ray.createActor(Counter::new, options);
|
RayActor<Counter> actor = Ray.createActor(Counter::new, options);
|
||||||
// Call increase 3 times.
|
// Call increase 3 times.
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
Ray.call(Counter::increase, actor).get();
|
actor.call(Counter::increase).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertFalse(Ray.call(Counter::wasCurrentActorReconstructed, actor).get());
|
Assert.assertFalse(actor.call(Counter::wasCurrentActorReconstructed).get());
|
||||||
|
|
||||||
// Kill the actor process.
|
// Kill the actor process.
|
||||||
int pid = Ray.call(Counter::getPid, actor).get();
|
int pid = actor.call(Counter::getPid).get();
|
||||||
Runtime.getRuntime().exec("kill -9 " + pid);
|
Runtime.getRuntime().exec("kill -9 " + pid);
|
||||||
// Wait for the actor to be killed.
|
// Wait for the actor to be killed.
|
||||||
TimeUnit.SECONDS.sleep(1);
|
TimeUnit.SECONDS.sleep(1);
|
||||||
|
|
||||||
// Try calling increase on this actor again and check the value is now 4.
|
// Try calling increase on this actor again and check the value is now 4.
|
||||||
int value = Ray.call(Counter::increase, actor).get();
|
int value = actor.call(Counter::increase).get();
|
||||||
Assert.assertEquals(value, options.useDirectCall ? 1 : 4);
|
Assert.assertEquals(value, options.useDirectCall ? 1 : 4);
|
||||||
|
|
||||||
Assert.assertTrue(Ray.call(Counter::wasCurrentActorReconstructed, actor).get());
|
Assert.assertTrue(actor.call(Counter::wasCurrentActorReconstructed).get());
|
||||||
|
|
||||||
// Kill the actor process again.
|
// Kill the actor process again.
|
||||||
pid = Ray.call(Counter::getPid, actor).get();
|
pid = actor.call(Counter::getPid).get();
|
||||||
Runtime.getRuntime().exec("kill -9 " + pid);
|
Runtime.getRuntime().exec("kill -9 " + pid);
|
||||||
TimeUnit.SECONDS.sleep(1);
|
TimeUnit.SECONDS.sleep(1);
|
||||||
|
|
||||||
// Try calling increase on this actor again and this should fail.
|
// Try calling increase on this actor again and this should fail.
|
||||||
try {
|
try {
|
||||||
Ray.call(Counter::increase, actor).get();
|
actor.call(Counter::increase).get();
|
||||||
Assert.fail("The above task didn't fail.");
|
Assert.fail("The above task didn't fail.");
|
||||||
} catch (RayActorException e) {
|
} catch (RayActorException e) {
|
||||||
// We should receive a RayActorException because the actor is dead.
|
// We should receive a RayActorException because the actor is dead.
|
||||||
|
@ -132,20 +130,20 @@ public class ActorReconstructionTest extends BaseTest {
|
||||||
RayActor<CheckpointableCounter> actor = Ray.createActor(CheckpointableCounter::new, options);
|
RayActor<CheckpointableCounter> actor = Ray.createActor(CheckpointableCounter::new, options);
|
||||||
// Call increase 3 times.
|
// Call increase 3 times.
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
Ray.call(CheckpointableCounter::increase, actor).get();
|
actor.call(CheckpointableCounter::increase).get();
|
||||||
}
|
}
|
||||||
// Assert that the actor wasn't resumed from a checkpoint.
|
// Assert that the actor wasn't resumed from a checkpoint.
|
||||||
Assert.assertFalse(Ray.call(CheckpointableCounter::wasResumedFromCheckpoint, actor).get());
|
Assert.assertFalse(actor.call(CheckpointableCounter::wasResumedFromCheckpoint).get());
|
||||||
int pid = Ray.call(CheckpointableCounter::getPid, actor).get();
|
int pid = actor.call(CheckpointableCounter::getPid).get();
|
||||||
Runtime.getRuntime().exec("kill -9 " + pid);
|
Runtime.getRuntime().exec("kill -9 " + pid);
|
||||||
// Wait for the actor to be killed.
|
// Wait for the actor to be killed.
|
||||||
TimeUnit.SECONDS.sleep(1);
|
TimeUnit.SECONDS.sleep(1);
|
||||||
|
|
||||||
// Try calling increase on this actor again and check the value is now 4.
|
// Try calling increase on this actor again and check the value is now 4.
|
||||||
int value = Ray.call(CheckpointableCounter::increase, actor).get();
|
int value = actor.call(CheckpointableCounter::increase).get();
|
||||||
Assert.assertEquals(value, 4);
|
Assert.assertEquals(value, 4);
|
||||||
// Assert that the actor was resumed from a checkpoint.
|
// Assert that the actor was resumed from a checkpoint.
|
||||||
Assert.assertTrue(Ray.call(CheckpointableCounter::wasResumedFromCheckpoint, actor).get());
|
Assert.assertTrue(actor.call(CheckpointableCounter::wasResumedFromCheckpoint).get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.ray.api.RayObject;
|
||||||
import org.ray.api.RayPyActor;
|
import org.ray.api.RayPyActor;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.TestUtils.LargeObject;
|
import org.ray.api.TestUtils.LargeObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.exception.UnreconstructableException;
|
import org.ray.api.exception.UnreconstructableException;
|
||||||
|
import org.ray.api.id.ActorId;
|
||||||
import org.ray.api.id.UniqueId;
|
import org.ray.api.id.UniqueId;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -19,7 +19,6 @@ import org.testng.annotations.Test;
|
||||||
@Test
|
@Test
|
||||||
public class ActorTest extends BaseTest {
|
public class ActorTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class Counter {
|
public static class Counter {
|
||||||
|
|
||||||
private int value;
|
private int value;
|
||||||
|
@ -50,13 +49,13 @@ public class ActorTest extends BaseTest {
|
||||||
public void testCreateAndCallActor() {
|
public void testCreateAndCallActor() {
|
||||||
// Test creating an actor from a constructor
|
// Test creating an actor from a constructor
|
||||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||||
Assert.assertNotEquals(actor.getId(), UniqueId.NIL);
|
Assert.assertNotEquals(actor.getId(), ActorId.NIL);
|
||||||
// A java actor is not a python actor
|
// A java actor is not a python actor
|
||||||
Assert.assertFalse(actor instanceof RayPyActor);
|
Assert.assertFalse(actor instanceof RayPyActor);
|
||||||
// Test calling an actor
|
// Test calling an actor
|
||||||
Assert.assertEquals(Integer.valueOf(1), Ray.call(Counter::getValue, actor).get());
|
Assert.assertEquals(Integer.valueOf(1), actor.call(Counter::getValue).get());
|
||||||
Ray.call(Counter::increase, actor, 1);
|
actor.call(Counter::increase, 1);
|
||||||
Assert.assertEquals(Integer.valueOf(3), Ray.call(Counter::increaseAndGet, actor, 1).get());
|
Assert.assertEquals(Integer.valueOf(3), actor.call(Counter::increaseAndGet, 1).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +70,7 @@ public class ActorTest extends BaseTest {
|
||||||
*/
|
*/
|
||||||
public void testGetDirectObjectTwice() {
|
public void testGetDirectObjectTwice() {
|
||||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||||
RayObject<Integer> result = Ray.call(Counter::getValue, actor);
|
RayObject<Integer> result = actor.call(Counter::getValue);
|
||||||
Assert.assertEquals(result.get(), Integer.valueOf(1));
|
Assert.assertEquals(result.get(), Integer.valueOf(1));
|
||||||
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.
|
// TODO(hchen): The following code will still fail, and can be fixed by using ref counting.
|
||||||
|
@ -82,10 +81,9 @@ public class ActorTest extends BaseTest {
|
||||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||||
LargeObject largeObject = new LargeObject();
|
LargeObject largeObject = new LargeObject();
|
||||||
Assert.assertEquals(Integer.valueOf(largeObject.data.length + 1),
|
Assert.assertEquals(Integer.valueOf(largeObject.data.length + 1),
|
||||||
Ray.call(Counter::accessLargeObject, actor, largeObject).get());
|
actor.call(Counter::accessLargeObject, largeObject).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
static Counter factory(int initValue) {
|
static Counter factory(int initValue) {
|
||||||
return new Counter(initValue);
|
return new Counter(initValue);
|
||||||
}
|
}
|
||||||
|
@ -95,24 +93,21 @@ public class ActorTest extends BaseTest {
|
||||||
RayActor<Counter> actor = Ray.createActor(ActorTest::factory, 1);
|
RayActor<Counter> actor = Ray.createActor(ActorTest::factory, 1);
|
||||||
Assert.assertNotEquals(actor.getId(), UniqueId.NIL);
|
Assert.assertNotEquals(actor.getId(), UniqueId.NIL);
|
||||||
// Test calling an actor
|
// Test calling an actor
|
||||||
Assert.assertEquals(Integer.valueOf(1), Ray.call(Counter::getValue, actor).get());
|
Assert.assertEquals(Integer.valueOf(1), actor.call(Counter::getValue).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
static int testActorAsFirstParameter(RayActor<Counter> actor, int delta) {
|
static int testActorAsFirstParameter(RayActor<Counter> actor, int delta) {
|
||||||
RayObject<Integer> res = Ray.call(Counter::increaseAndGet, actor, delta);
|
RayObject<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||||
return res.get();
|
return res.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
static int testActorAsSecondParameter(int delta, RayActor<Counter> actor) {
|
static int testActorAsSecondParameter(int delta, RayActor<Counter> actor) {
|
||||||
RayObject<Integer> res = Ray.call(Counter::increaseAndGet, actor, delta);
|
RayObject<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||||
return res.get();
|
return res.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
static int testActorAsFieldOfParameter(List<RayActor<Counter>> actor, int delta) {
|
static int testActorAsFieldOfParameter(List<RayActor<Counter>> actor, int delta) {
|
||||||
RayObject<Integer> res = Ray.call(Counter::increaseAndGet, actor.get(0), delta);
|
RayObject<Integer> res = actor.get(0).call(Counter::increaseAndGet, delta);
|
||||||
return res.get();
|
return res.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +129,7 @@ public class ActorTest extends BaseTest {
|
||||||
TestUtils.skipTestIfDirectActorCallEnabled();
|
TestUtils.skipTestIfDirectActorCallEnabled();
|
||||||
RayActor<Counter> counter = Ray.createActor(Counter::new, 100);
|
RayActor<Counter> counter = Ray.createActor(Counter::new, 100);
|
||||||
// Call an actor method.
|
// Call an actor method.
|
||||||
RayObject value = Ray.call(Counter::getValue, counter);
|
RayObject value = counter.call(Counter::getValue);
|
||||||
Assert.assertEquals(100, value.get());
|
Assert.assertEquals(100, value.get());
|
||||||
// Delete the object from the object store.
|
// Delete the object from the object store.
|
||||||
Ray.internal().free(ImmutableList.of(value.getId()), false, false);
|
Ray.internal().free(ImmutableList.of(value.getId()), false, false);
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.RayPyActor;
|
import org.ray.api.RayPyActor;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.runtime.actor.NativeRayActor;
|
import org.ray.runtime.actor.NativeRayActor;
|
||||||
import org.ray.runtime.actor.NativeRayPyActor;
|
import org.ray.runtime.actor.NativeRayPyActor;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -117,7 +116,6 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||||
return (byte[])res.get();
|
return (byte[])res.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote // Python can create java actors without @RayRemote
|
|
||||||
public static class TestActor {
|
public static class TestActor {
|
||||||
public TestActor(byte[] v) {
|
public TestActor(byte[] v) {
|
||||||
value = v;
|
value = v;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.WaitResult;
|
import org.ray.api.WaitResult;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.options.CallOptions;
|
import org.ray.api.options.CallOptions;
|
||||||
import org.ray.api.runtimecontext.NodeInfo;
|
import org.ray.api.runtimecontext.NodeInfo;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
@ -15,7 +14,6 @@ import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class DynamicResourceTest extends BaseTest {
|
public class DynamicResourceTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String sayHi() {
|
public static String sayHi() {
|
||||||
return "hi";
|
return "hi";
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,14 +95,14 @@ public class FailureTest extends BaseTest {
|
||||||
public void testActorCreationFailure() {
|
public void testActorCreationFailure() {
|
||||||
TestUtils.skipTestUnderSingleProcess();
|
TestUtils.skipTestUnderSingleProcess();
|
||||||
RayActor<BadActor> actor = Ray.createActor(BadActor::new, true);
|
RayActor<BadActor> actor = Ray.createActor(BadActor::new, true);
|
||||||
assertTaskFailedWithRayTaskException(Ray.call(BadActor::badMethod, actor));
|
assertTaskFailedWithRayTaskException(actor.call(BadActor::badMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testActorTaskFailure() {
|
public void testActorTaskFailure() {
|
||||||
TestUtils.skipTestUnderSingleProcess();
|
TestUtils.skipTestUnderSingleProcess();
|
||||||
RayActor<BadActor> actor = Ray.createActor(BadActor::new, false);
|
RayActor<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||||
assertTaskFailedWithRayTaskException(Ray.call(BadActor::badMethod, actor));
|
assertTaskFailedWithRayTaskException(actor.call(BadActor::badMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -125,14 +125,14 @@ public class FailureTest extends BaseTest {
|
||||||
TestUtils.skipTestIfDirectActorCallEnabled();
|
TestUtils.skipTestIfDirectActorCallEnabled();
|
||||||
RayActor<BadActor> actor = Ray.createActor(BadActor::new, false);
|
RayActor<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||||
try {
|
try {
|
||||||
Ray.call(BadActor::badMethod2, actor).get();
|
actor.call(BadActor::badMethod2).get();
|
||||||
Assert.fail("This line shouldn't be reached.");
|
Assert.fail("This line shouldn't be reached.");
|
||||||
} catch (RayActorException e) {
|
} catch (RayActorException e) {
|
||||||
// When the actor process dies while executing a task, we should receive an
|
// When the actor process dies while executing a task, we should receive an
|
||||||
// RayActorException.
|
// RayActorException.
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Ray.call(BadActor::badMethod, actor).get();
|
actor.call(BadActor::badMethod).get();
|
||||||
Assert.fail("This line shouldn't be reached.");
|
Assert.fail("This line shouldn't be reached.");
|
||||||
} catch (RayActorException e) {
|
} catch (RayActorException e) {
|
||||||
// When a actor task is submitted to a dead actor, we should also receive an
|
// When a actor task is submitted to a dead actor, we should also receive an
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.ray.api.test;
|
||||||
|
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -11,17 +10,14 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
public class HelloWorldTest extends BaseTest {
|
public class HelloWorldTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String hello() {
|
private static String hello() {
|
||||||
return "hello";
|
return "hello";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String world() {
|
private static String world() {
|
||||||
return "world!";
|
return "world!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String merge(String hello, String world) {
|
private static String merge(String hello, String world) {
|
||||||
return hello + "," + world;
|
return hello + "," + world;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.exception.RayActorException;
|
import org.ray.api.exception.RayActorException;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -13,7 +12,6 @@ import org.testng.annotations.Test;
|
||||||
@Test
|
@Test
|
||||||
public class KillActorTest extends BaseTest {
|
public class KillActorTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class HangActor {
|
public static class HangActor {
|
||||||
|
|
||||||
public boolean alive() {
|
public boolean alive() {
|
||||||
|
@ -31,8 +29,8 @@ public class KillActorTest extends BaseTest {
|
||||||
TestUtils.skipTestUnderSingleProcess();
|
TestUtils.skipTestUnderSingleProcess();
|
||||||
TestUtils.skipTestIfDirectActorCallDisabled();
|
TestUtils.skipTestIfDirectActorCallDisabled();
|
||||||
RayActor<HangActor> actor = Ray.createActor(HangActor::new);
|
RayActor<HangActor> actor = Ray.createActor(HangActor::new);
|
||||||
Assert.assertTrue(Ray.call(HangActor::alive, actor).get());
|
Assert.assertTrue(actor.call(HangActor::alive).get());
|
||||||
RayObject<Boolean> result = Ray.call(HangActor::hang, actor);
|
RayObject<Boolean> result = actor.call(HangActor::hang);
|
||||||
Assert.assertEquals(0, Ray.wait(ImmutableList.of(result), 1, 500).getReady().size());
|
Assert.assertEquals(0, Ray.wait(ImmutableList.of(result), 1, 500).getReady().size());
|
||||||
Ray.killActor(actor);
|
Ray.killActor(actor);
|
||||||
Assert.expectThrows(RayActorException.class, result::get);
|
Assert.expectThrows(RayActorException.class, result::get);
|
||||||
|
|
|
@ -2,13 +2,11 @@ package org.ray.api.test;
|
||||||
|
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class MultiLanguageClusterTest extends BaseMultiLanguageTest {
|
public class MultiLanguageClusterTest extends BaseMultiLanguageTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String echo(String word) {
|
public static String echo(String word) {
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.WaitResult;
|
import org.ray.api.WaitResult;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.id.ActorId;
|
import org.ray.api.id.ActorId;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -29,21 +28,17 @@ public class MultiThreadingTest extends BaseTest {
|
||||||
private static final int LOOP_COUNTER = 100;
|
private static final int LOOP_COUNTER = 100;
|
||||||
private static final int NUM_THREADS = 20;
|
private static final int NUM_THREADS = 20;
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
static Integer echo(int num) {
|
static Integer echo(int num) {
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class Echo {
|
public static class Echo {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public Integer echo(int num) {
|
public Integer echo(int num) {
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class ActorIdTester {
|
public static class ActorIdTester {
|
||||||
|
|
||||||
private final ActorId actorId;
|
private final ActorId actorId;
|
||||||
|
@ -53,7 +48,6 @@ public class MultiThreadingTest extends BaseTest {
|
||||||
Assert.assertNotEquals(actorId, ActorId.NIL);
|
Assert.assertNotEquals(actorId, ActorId.NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public ActorId getCurrentActorId() throws Exception {
|
public ActorId getCurrentActorId() throws Exception {
|
||||||
final Object[] result = new Object[1];
|
final Object[] result = new Object[1];
|
||||||
Thread thread = new Thread(Ray.wrapRunnable(() -> {
|
Thread thread = new Thread(Ray.wrapRunnable(() -> {
|
||||||
|
@ -86,7 +80,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||||
RayActor<Echo> echoActor = Ray.createActor(Echo::new);
|
RayActor<Echo> echoActor = Ray.createActor(Echo::new);
|
||||||
runTestCaseInMultipleThreads(() -> {
|
runTestCaseInMultipleThreads(() -> {
|
||||||
int arg = random.nextInt();
|
int arg = random.nextInt();
|
||||||
RayObject<Integer> obj = Ray.call(Echo::echo, echoActor, arg);
|
RayObject<Integer> obj = echoActor.call(Echo::echo, arg);
|
||||||
Assert.assertEquals(arg, (int) obj.get());
|
Assert.assertEquals(arg, (int) obj.get());
|
||||||
}, LOOP_COUNTER);
|
}, LOOP_COUNTER);
|
||||||
|
|
||||||
|
@ -101,7 +95,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LOGGER.warn("Got exception while sleeping.", e);
|
LOGGER.warn("Got exception while sleeping.", e);
|
||||||
}
|
}
|
||||||
RayObject<Integer> obj = Ray.call(Echo::echo, echoActor1, arg);
|
RayObject<Integer> obj = echoActor1.call(Echo::echo, arg);
|
||||||
Assert.assertEquals(arg, (int) obj.get());
|
Assert.assertEquals(arg, (int) obj.get());
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
@ -137,7 +131,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||||
public void testGetCurrentActorId() {
|
public void testGetCurrentActorId() {
|
||||||
TestUtils.skipTestUnderSingleProcess();
|
TestUtils.skipTestUnderSingleProcess();
|
||||||
RayActor<ActorIdTester> actorIdTester = Ray.createActor(ActorIdTester::new);
|
RayActor<ActorIdTester> actorIdTester = Ray.createActor(ActorIdTester::new);
|
||||||
ActorId actorId = Ray.call(ActorIdTester::getCurrentActorId, actorIdTester).get();
|
ActorId actorId = actorIdTester.call(ActorIdTester::getCurrentActorId).get();
|
||||||
Assert.assertEquals(actorId, actorIdTester.getId());
|
Assert.assertEquals(actorId, actorIdTester.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,12 @@ import java.util.Arrays;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.id.TaskId;
|
import org.ray.api.id.TaskId;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class PlasmaFreeTest extends BaseTest {
|
public class PlasmaFreeTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String hello() {
|
private static String hello() {
|
||||||
return "hello";
|
return "hello";
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Map;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.TestUtils.LargeObject;
|
import org.ray.api.TestUtils.LargeObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.id.ObjectId;
|
import org.ray.api.id.ObjectId;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -17,62 +16,50 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
public class RayCallTest extends BaseTest {
|
public class RayCallTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testInt(int val) {
|
private static int testInt(int val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static byte testByte(byte val) {
|
private static byte testByte(byte val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static short testShort(short val) {
|
private static short testShort(short val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static long testLong(long val) {
|
private static long testLong(long val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static double testDouble(double val) {
|
private static double testDouble(double val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static float testFloat(float val) {
|
private static float testFloat(float val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static boolean testBool(boolean val) {
|
private static boolean testBool(boolean val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String testString(String val) {
|
private static String testString(String val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static List<Integer> testList(List<Integer> val) {
|
private static List<Integer> testList(List<Integer> val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static Map<String, Integer> testMap(Map<String, Integer> val) {
|
private static Map<String, Integer> testMap(Map<String, Integer> val) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static LargeObject testLargeObject(LargeObject largeObject) {
|
private static LargeObject testLargeObject(LargeObject largeObject) {
|
||||||
return largeObject;
|
return largeObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static void testNoReturn(ObjectId objectId) {
|
private static void testNoReturn(ObjectId objectId) {
|
||||||
// Put an object in object store to inform driver that this function is executing.
|
// Put an object in object store to inform driver that this function is executing.
|
||||||
TestUtils.getRuntime().getObjectStore().put(1, objectId);
|
TestUtils.getRuntime().getObjectStore().put(1, objectId);
|
||||||
|
@ -103,37 +90,30 @@ public class RayCallTest extends BaseTest {
|
||||||
Assert.assertEquals(((int) Ray.get(randomObjectId)), 1);
|
Assert.assertEquals(((int) Ray.get(randomObjectId)), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testNoParam() {
|
private static int testNoParam() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testOneParam(int a) {
|
private static int testOneParam(int a) {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testTwoParams(int a, int b) {
|
private static int testTwoParams(int a, int b) {
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testThreeParams(int a, int b, int c) {
|
private static int testThreeParams(int a, int b, int c) {
|
||||||
return a + b + c;
|
return a + b + c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testFourParams(int a, int b, int c, int d) {
|
private static int testFourParams(int a, int b, int c, int d) {
|
||||||
return a + b + c + d;
|
return a + b + c + d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testFiveParams(int a, int b, int c, int d, int e) {
|
private static int testFiveParams(int a, int b, int c, int d, int e) {
|
||||||
return a + b + c + d + e;
|
return a + b + c + d + e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static int testSixParams(int a, int b, int c, int d, int e, int f) {
|
private static int testSixParams(int a, int b, int c, int d, int e, int f) {
|
||||||
return a + b + c + d + e + f;
|
return a + b + c + d + e + f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.ray.api.test;
|
||||||
|
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
@ -22,7 +21,6 @@ public class RedisPasswordTest extends BaseTest {
|
||||||
System.clearProperty("ray.redis.password");
|
System.clearProperty("ray.redis.password");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String echo(String str) {
|
public static String echo(String str) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.WaitResult;
|
import org.ray.api.WaitResult;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.options.ActorCreationOptions;
|
import org.ray.api.options.ActorCreationOptions;
|
||||||
import org.ray.api.options.CallOptions;
|
import org.ray.api.options.CallOptions;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
@ -30,12 +29,10 @@ public class ResourcesManagementTest extends BaseTest {
|
||||||
System.clearProperty("ray.resources");
|
System.clearProperty("ray.resources");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static Integer echo(Integer number) {
|
public static Integer echo(Integer number) {
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class Echo {
|
public static class Echo {
|
||||||
|
|
||||||
public Integer echo(Integer number) {
|
public Integer echo(Integer number) {
|
||||||
|
@ -84,7 +81,7 @@ public class ResourcesManagementTest extends BaseTest {
|
||||||
// This is a case that can satisfy required resources.
|
// This is a case that can satisfy required resources.
|
||||||
// The static resources for test are "CPU:4,RES-A:4".
|
// The static resources for test are "CPU:4,RES-A:4".
|
||||||
RayActor<Echo> echo1 = Ray.createActor(Echo::new, actorCreationOptions1);
|
RayActor<Echo> echo1 = Ray.createActor(Echo::new, actorCreationOptions1);
|
||||||
final RayObject<Integer> result1 = Ray.call(Echo::echo, echo1, 100);
|
final RayObject<Integer> result1 = echo1.call(Echo::echo, 100);
|
||||||
Assert.assertEquals(100, (int) result1.get());
|
Assert.assertEquals(100, (int) result1.get());
|
||||||
|
|
||||||
// This is a case that can't satisfy required resources.
|
// This is a case that can't satisfy required resources.
|
||||||
|
@ -94,7 +91,7 @@ public class ResourcesManagementTest extends BaseTest {
|
||||||
|
|
||||||
RayActor<ResourcesManagementTest.Echo> echo2 =
|
RayActor<ResourcesManagementTest.Echo> echo2 =
|
||||||
Ray.createActor(Echo::new, actorCreationOptions2);
|
Ray.createActor(Echo::new, actorCreationOptions2);
|
||||||
final RayObject<Integer> result2 = Ray.call(Echo::echo, echo2, 100);
|
final RayObject<Integer> result2 = echo2.call(Echo::echo, 100);
|
||||||
WaitResult<Integer> waitResult = Ray.wait(ImmutableList.of(result2), 1, 1000);
|
WaitResult<Integer> waitResult = Ray.wait(ImmutableList.of(result2), 1, 1000);
|
||||||
|
|
||||||
Assert.assertEquals(0, waitResult.getReady().size());
|
Assert.assertEquals(0, waitResult.getReady().size());
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.nio.ByteBuffer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.id.ActorId;
|
import org.ray.api.id.ActorId;
|
||||||
import org.ray.api.id.JobId;
|
import org.ray.api.id.JobId;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
@ -47,7 +46,6 @@ public class RuntimeContextTest extends BaseTest {
|
||||||
Ray.getRuntimeContext().getObjectStoreSocketName());
|
Ray.getRuntimeContext().getObjectStoreSocketName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class RuntimeContextTester {
|
public static class RuntimeContextTester {
|
||||||
|
|
||||||
public String testRuntimeContext(ActorId actorId) {
|
public String testRuntimeContext(ActorId actorId) {
|
||||||
|
@ -64,7 +62,7 @@ public class RuntimeContextTest extends BaseTest {
|
||||||
public void testRuntimeContextInActor() {
|
public void testRuntimeContextInActor() {
|
||||||
RayActor<RuntimeContextTester> actor = Ray.createActor(RuntimeContextTester::new);
|
RayActor<RuntimeContextTester> actor = Ray.createActor(RuntimeContextTester::new);
|
||||||
Assert.assertEquals("ok",
|
Assert.assertEquals("ok",
|
||||||
Ray.call(RuntimeContextTester::testRuntimeContext, actor, actor.getId()).get());
|
actor.call(RuntimeContextTester::testRuntimeContext, actor.getId()).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.id.ActorId;
|
import org.ray.api.id.ActorId;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -19,7 +18,6 @@ public class SingleProcessModeTest extends BaseTest {
|
||||||
|
|
||||||
private static final int TIMES_TO_CALL_PER_ACTOR = 10;
|
private static final int TIMES_TO_CALL_PER_ACTOR = 10;
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
static class MyActor {
|
static class MyActor {
|
||||||
public MyActor() {
|
public MyActor() {
|
||||||
}
|
}
|
||||||
|
@ -38,7 +36,7 @@ public class SingleProcessModeTest extends BaseTest {
|
||||||
for (int i = 0; i < NUM_ACTOR_INSTANCE; ++i) {
|
for (int i = 0; i < NUM_ACTOR_INSTANCE; ++i) {
|
||||||
RayActor<MyActor> actor = Ray.createActor(MyActor::new);
|
RayActor<MyActor> actor = Ray.createActor(MyActor::new);
|
||||||
actors.add(actor);
|
actors.add(actor);
|
||||||
actorThreadIds.put(actor.getId(), Ray.call(MyActor::getThreadId, actor).get());
|
actorThreadIds.put(actor.getId(), actor.call(MyActor::getThreadId).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<ActorId, List<RayObject<Long>>> allResults = new HashMap<>();
|
Map<ActorId, List<RayObject<Long>>> allResults = new HashMap<>();
|
||||||
|
@ -46,7 +44,7 @@ public class SingleProcessModeTest extends BaseTest {
|
||||||
final RayActor<MyActor> actor = actors.get(i);
|
final RayActor<MyActor> actor = actors.get(i);
|
||||||
List<RayObject<Long>> thisActorResult = new ArrayList<>();
|
List<RayObject<Long>> thisActorResult = new ArrayList<>();
|
||||||
for (int j = 0; j < TIMES_TO_CALL_PER_ACTOR; ++j) {
|
for (int j = 0; j < TIMES_TO_CALL_PER_ACTOR; ++j) {
|
||||||
thisActorResult.add(Ray.call(MyActor::getThreadId, actor));
|
thisActorResult.add(actor.call(MyActor::getThreadId));
|
||||||
}
|
}
|
||||||
allResults.put(actor.getId(), thisActorResult);
|
allResults.put(actor.getId(), thisActorResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class StressTest extends BaseTest {
|
||||||
public int ping(int n) {
|
public int ping(int n) {
|
||||||
List<ObjectId> objectIds = new ArrayList<>();
|
List<ObjectId> objectIds = new ArrayList<>();
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
objectIds.add(Ray.call(Actor::ping, actor).getId());
|
objectIds.add(actor.call(Actor::ping).getId());
|
||||||
}
|
}
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (Integer result : Ray.<Integer>get(objectIds)) {
|
for (Integer result : Ray.<Integer>get(objectIds)) {
|
||||||
|
@ -81,7 +81,7 @@ public class StressTest extends BaseTest {
|
||||||
List<ObjectId> objectIds = new ArrayList<>();
|
List<ObjectId> objectIds = new ArrayList<>();
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
RayActor<Worker> worker = Ray.createActor(Worker::new, actor);
|
RayActor<Worker> worker = Ray.createActor(Worker::new, actor);
|
||||||
objectIds.add(Ray.call(Worker::ping, worker, 100).getId());
|
objectIds.add(worker.call(Worker::ping, 100).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Integer result : Ray.<Integer>get(objectIds)) {
|
for (Integer result : Ray.<Integer>get(objectIds)) {
|
||||||
|
|
|
@ -7,18 +7,15 @@ import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.WaitResult;
|
import org.ray.api.WaitResult;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class WaitTest extends BaseTest {
|
public class WaitTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String hi() {
|
private static String hi() {
|
||||||
return "hi";
|
return "hi";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
private static String delayedHi() {
|
private static String delayedHi() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100 * 1000);
|
Thread.sleep(100 * 1000);
|
||||||
|
@ -50,7 +47,6 @@ public class WaitTest extends BaseTest {
|
||||||
testWait();
|
testWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static Object waitInWorker() {
|
public static Object waitInWorker() {
|
||||||
testWait();
|
testWait();
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -4,14 +4,12 @@ import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.TestUtils;
|
import org.ray.api.TestUtils;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.options.ActorCreationOptions;
|
import org.ray.api.options.ActorCreationOptions;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class WorkerJvmOptionsTest extends BaseTest {
|
public class WorkerJvmOptionsTest extends BaseTest {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static class Echo {
|
public static class Echo {
|
||||||
String getOptions() {
|
String getOptions() {
|
||||||
return System.getProperty("test.suffix");
|
return System.getProperty("test.suffix");
|
||||||
|
@ -27,7 +25,7 @@ public class WorkerJvmOptionsTest extends BaseTest {
|
||||||
.setJvmOptions(" -Dtest.suffix=suffix -Dtest.suffix1=suffix1 ")
|
.setJvmOptions(" -Dtest.suffix=suffix -Dtest.suffix1=suffix1 ")
|
||||||
.createActorCreationOptions();
|
.createActorCreationOptions();
|
||||||
RayActor<Echo> actor = Ray.createActor(Echo::new, options);
|
RayActor<Echo> actor = Ray.createActor(Echo::new, options);
|
||||||
RayObject<String> obj = Ray.call(Echo::getOptions, actor);
|
RayObject<String> obj = actor.call(Echo::getOptions);
|
||||||
Assert.assertEquals(obj.get(), "suffix");
|
Assert.assertEquals(obj.get(), "suffix");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.exercise;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a remote function, and execute multiple remote functions in parallel.
|
* Define a remote function, and execute multiple remote functions in parallel.
|
||||||
|
@ -13,15 +12,12 @@ public class Exercise01 implements Serializable {
|
||||||
/**
|
/**
|
||||||
* A plain remote function.
|
* A plain remote function.
|
||||||
*/
|
*/
|
||||||
// `@RayRemote` annotation converts a normal function to a remote function.
|
|
||||||
@RayRemote
|
|
||||||
public static String sayHello() {
|
public static String sayHello() {
|
||||||
String ret = "hello";
|
String ret = "hello";
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String sayWorld() {
|
public static String sayWorld() {
|
||||||
String ret = "world!";
|
String ret = "world!";
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
|
|
|
@ -2,21 +2,18 @@ package org.ray.exercise;
|
||||||
|
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute remote functions in parallel with some dependencies.
|
* Execute remote functions in parallel with some dependencies.
|
||||||
*/
|
*/
|
||||||
public class Exercise02 {
|
public class Exercise02 {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String sayHello() {
|
public static String sayHello() {
|
||||||
String ret = "hello";
|
String ret = "hello";
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String sayWorld() {
|
public static String sayWorld() {
|
||||||
String ret = "world!";
|
String ret = "world!";
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
|
@ -26,7 +23,6 @@ public class Exercise02 {
|
||||||
/**
|
/**
|
||||||
* A remote function with dependency.
|
* A remote function with dependency.
|
||||||
*/
|
*/
|
||||||
@RayRemote
|
|
||||||
public static String merge(String hello, String world) {
|
public static String merge(String hello, String world) {
|
||||||
return hello + "," + world;
|
return hello + "," + world;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.ray.exercise;
|
||||||
|
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call a remote function from within another remote function.
|
* Call a remote function from within another remote function.
|
||||||
|
@ -12,7 +11,6 @@ public class Exercise03 {
|
||||||
/**
|
/**
|
||||||
* A remote function which will call another remote function.
|
* A remote function which will call another remote function.
|
||||||
*/
|
*/
|
||||||
@RayRemote
|
|
||||||
public static String sayHelloWithWorld() {
|
public static String sayHelloWithWorld() {
|
||||||
String ret = "hello";
|
String ret = "hello";
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
|
@ -23,7 +21,6 @@ public class Exercise03 {
|
||||||
/**
|
/**
|
||||||
* A remote function which will be called by another remote function.
|
* A remote function which will be called by another remote function.
|
||||||
*/
|
*/
|
||||||
@RayRemote
|
|
||||||
public static String sayWorld() {
|
public static String sayWorld() {
|
||||||
String ret = "world!";
|
String ret = "world!";
|
||||||
System.out.println(ret);
|
System.out.println(ret);
|
||||||
|
|
|
@ -5,20 +5,17 @@ import java.util.List;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.WaitResult;
|
import org.ray.api.WaitResult;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use Ray.wait to ignore stragglers
|
* Use Ray.wait to ignore stragglers
|
||||||
*/
|
*/
|
||||||
public class Exercise04 {
|
public class Exercise04 {
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String f1() {
|
public static String f1() {
|
||||||
System.out.println("Executing f1");
|
System.out.println("Executing f1");
|
||||||
return "f1";
|
return "f1";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
public static String f2() {
|
public static String f2() {
|
||||||
System.out.println("Executing f2");
|
System.out.println("Executing f2");
|
||||||
return "f2";
|
return "f2";
|
||||||
|
@ -27,7 +24,6 @@ public class Exercise04 {
|
||||||
/**
|
/**
|
||||||
* A slow remote function.
|
* A slow remote function.
|
||||||
*/
|
*/
|
||||||
@RayRemote
|
|
||||||
public static String f3() {
|
public static String f3() {
|
||||||
System.out.println("Executing f3");
|
System.out.println("Executing f3");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.ray.exercise;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.RayObject;
|
import org.ray.api.RayObject;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show usage of actors.
|
* Show usage of actors.
|
||||||
|
@ -16,9 +15,9 @@ public class Exercise05 {
|
||||||
// `Ray.createActor` creates an actor instance.
|
// `Ray.createActor` creates an actor instance.
|
||||||
RayActor<Adder> adder = Ray.createActor(Adder::new, 0);
|
RayActor<Adder> adder = Ray.createActor(Adder::new, 0);
|
||||||
// Use `Ray.call(actor, parameters)` to call an actor method.
|
// Use `Ray.call(actor, parameters)` to call an actor method.
|
||||||
RayObject<Integer> result1 = Ray.call(Adder::add, adder, 1);
|
RayObject<Integer> result1 = adder.call(Adder::add, 1);
|
||||||
System.out.println(result1.get());
|
System.out.println(result1.get());
|
||||||
RayObject<Integer> result2 = Ray.call(Adder::add, adder, 10);
|
RayObject<Integer> result2 = adder.call(Adder::add, 10);
|
||||||
System.out.println(result2.get());
|
System.out.println(result2.get());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
@ -30,8 +29,6 @@ public class Exercise05 {
|
||||||
/**
|
/**
|
||||||
* An example actor.
|
* An example actor.
|
||||||
*/
|
*/
|
||||||
// `@RayRemote` annotation also converts a normal class to an actor.
|
|
||||||
@RayRemote
|
|
||||||
public static class Adder {
|
public static class Adder {
|
||||||
|
|
||||||
public Adder(int initValue) {
|
public Adder(int initValue) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.msgpack.core.Preconditions;
|
import org.msgpack.core.Preconditions;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.streaming.api.context.StreamingContext;
|
import org.ray.streaming.api.context.StreamingContext;
|
||||||
import org.ray.streaming.python.PythonFunction;
|
import org.ray.streaming.python.PythonFunction;
|
||||||
import org.ray.streaming.python.PythonPartition;
|
import org.ray.streaming.python.PythonPartition;
|
||||||
|
@ -24,7 +23,6 @@ import org.slf4j.LoggerFactory;
|
||||||
* `streaming/python/runtime/gateway_client.py`
|
* `streaming/python/runtime/gateway_client.py`
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@RayRemote
|
|
||||||
public class PythonGateway {
|
public class PythonGateway {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(PythonGateway.class);
|
private static final Logger LOG = LoggerFactory.getLogger(PythonGateway.class);
|
||||||
private static final String REFERENCE_ID_PREFIX = "__gateway_reference_id__";
|
private static final String REFERENCE_ID_PREFIX = "__gateway_reference_id__";
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class JobSchedulerImpl implements JobScheduler {
|
||||||
switch (executionNode.getLanguage()) {
|
switch (executionNode.getLanguage()) {
|
||||||
case JAVA:
|
case JAVA:
|
||||||
RayActor<JobWorker> jobWorker = (RayActor<JobWorker>) worker;
|
RayActor<JobWorker> jobWorker = (RayActor<JobWorker>) worker;
|
||||||
waits.add(Ray.call(JobWorker::init, jobWorker,
|
waits.add(jobWorker.call(JobWorker::init,
|
||||||
new WorkerContext(taskId, executionGraph, jobConfig)));
|
new WorkerContext(taskId, executionGraph, jobConfig)));
|
||||||
break;
|
break;
|
||||||
case PYTHON:
|
case PYTHON:
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.runtime.RayMultiWorkerNativeRuntime;
|
import org.ray.runtime.RayMultiWorkerNativeRuntime;
|
||||||
import org.ray.runtime.functionmanager.JavaFunctionDescriptor;
|
import org.ray.runtime.functionmanager.JavaFunctionDescriptor;
|
||||||
import org.ray.streaming.runtime.core.graph.ExecutionGraph;
|
import org.ray.streaming.runtime.core.graph.ExecutionGraph;
|
||||||
|
@ -28,7 +27,6 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* The stream job worker, it is a ray actor.
|
* The stream job worker, it is a ray actor.
|
||||||
*/
|
*/
|
||||||
@RayRemote
|
|
||||||
public class JobWorker implements Serializable {
|
public class JobWorker implements Serializable {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(JobWorker.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(JobWorker.class);
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,11 @@ public class StreamingQueueTest extends BaseUnitTest implements Serializable {
|
||||||
builder.createActorCreationOptions());
|
builder.createActorCreationOptions());
|
||||||
|
|
||||||
LOGGER.info("call getName on writerActor: {}",
|
LOGGER.info("call getName on writerActor: {}",
|
||||||
Ray.call(WriterWorker::getName, writerActor).get());
|
writerActor.call(WriterWorker::getName).get());
|
||||||
LOGGER.info("call getName on readerActor: {}",
|
LOGGER.info("call getName on readerActor: {}",
|
||||||
Ray.call(ReaderWorker::getName, readerActor).get());
|
readerActor.call(ReaderWorker::getName).get());
|
||||||
|
|
||||||
// LOGGER.info(Ray.call(WriterWorker::testCallReader, writerActor, readerActor).get());
|
// LOGGER.info(writerActor.call(WriterWorker::testCallReader, readerActor).get());
|
||||||
List<String> outputQueueList = new ArrayList<>();
|
List<String> outputQueueList = new ArrayList<>();
|
||||||
List<String> inputQueueList = new ArrayList<>();
|
List<String> inputQueueList = new ArrayList<>();
|
||||||
int queueNum = 2;
|
int queueNum = 2;
|
||||||
|
@ -118,17 +118,17 @@ public class StreamingQueueTest extends BaseUnitTest implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
final int msgCount = 100;
|
final int msgCount = 100;
|
||||||
Ray.call(ReaderWorker::init, readerActor, inputQueueList, writerActor, msgCount);
|
readerActor.call(ReaderWorker::init, inputQueueList, writerActor, msgCount);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Ray.call(WriterWorker::init, writerActor, outputQueueList, readerActor, msgCount);
|
writerActor.call(WriterWorker::init, outputQueueList, readerActor, msgCount);
|
||||||
|
|
||||||
long time = 0;
|
long time = 0;
|
||||||
while (time < 20000 &&
|
while (time < 20000 &&
|
||||||
Ray.call(ReaderWorker::getTotalMsg, readerActor).get() < msgCount * queueNum) {
|
readerActor.call(ReaderWorker::getTotalMsg).get() < msgCount * queueNum) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
time += 1000;
|
time += 1000;
|
||||||
|
@ -138,7 +138,7 @@ public class StreamingQueueTest extends BaseUnitTest implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
Ray.call(ReaderWorker::getTotalMsg, readerActor).get().intValue(),
|
readerActor.call(ReaderWorker::getTotalMsg).get().intValue(),
|
||||||
msgCount * queueNum);
|
msgCount * queueNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.ray.api.Ray;
|
import org.ray.api.Ray;
|
||||||
import org.ray.api.RayActor;
|
import org.ray.api.RayActor;
|
||||||
import org.ray.api.annotation.RayRemote;
|
|
||||||
import org.ray.api.id.ActorId;
|
import org.ray.api.id.ActorId;
|
||||||
import org.ray.runtime.RayMultiWorkerNativeRuntime;
|
import org.ray.runtime.RayMultiWorkerNativeRuntime;
|
||||||
import org.ray.runtime.actor.NativeRayActor;
|
import org.ray.runtime.actor.NativeRayActor;
|
||||||
|
@ -59,7 +58,6 @@ public class Worker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
class ReaderWorker extends Worker {
|
class ReaderWorker extends Worker {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ReaderWorker.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ReaderWorker.class);
|
||||||
|
|
||||||
|
@ -68,7 +66,7 @@ class ReaderWorker extends Worker {
|
||||||
private List<ActorId> inputActorIds = new ArrayList<>();
|
private List<ActorId> inputActorIds = new ArrayList<>();
|
||||||
private DataReader dataReader = null;
|
private DataReader dataReader = null;
|
||||||
private long handler = 0;
|
private long handler = 0;
|
||||||
private RayActor peerActor = null;
|
private RayActor<WriterWorker> peerActor = null;
|
||||||
private int msgCount = 0;
|
private int msgCount = 0;
|
||||||
private int totalMsg = 0;
|
private int totalMsg = 0;
|
||||||
|
|
||||||
|
@ -90,7 +88,7 @@ class ReaderWorker extends Worker {
|
||||||
return "testRayCall";
|
return "testRayCall";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean init(List<String> inputQueueList, RayActor peer, int msgCount) {
|
public boolean init(List<String> inputQueueList, RayActor<WriterWorker> peer, int msgCount) {
|
||||||
|
|
||||||
this.inputQueueList = inputQueueList;
|
this.inputQueueList = inputQueueList;
|
||||||
this.peerActor = peer;
|
this.peerActor = peer;
|
||||||
|
@ -176,7 +174,6 @@ class ReaderWorker extends Worker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RayRemote
|
|
||||||
class WriterWorker extends Worker {
|
class WriterWorker extends Worker {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WriterWorker.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WriterWorker.class);
|
||||||
|
|
||||||
|
@ -184,7 +181,7 @@ class WriterWorker extends Worker {
|
||||||
private List<String> outputQueueList = null;
|
private List<String> outputQueueList = null;
|
||||||
private List<ActorId> outputActorIds = new ArrayList<>();
|
private List<ActorId> outputActorIds = new ArrayList<>();
|
||||||
DataWriter dataWriter = null;
|
DataWriter dataWriter = null;
|
||||||
RayActor peerActor = null;
|
RayActor<ReaderWorker> peerActor = null;
|
||||||
int msgCount = 0;
|
int msgCount = 0;
|
||||||
|
|
||||||
public WriterWorker(String name) {
|
public WriterWorker(String name) {
|
||||||
|
@ -199,13 +196,13 @@ class WriterWorker extends Worker {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String testCallReader(RayActor readerActor) {
|
public String testCallReader(RayActor<ReaderWorker> readerActor) {
|
||||||
String name = (String) Ray.call(ReaderWorker::getName, readerActor).get();
|
String name = readerActor.call(ReaderWorker::getName).get();
|
||||||
LOGGER.info("testCallReader: {}", name);
|
LOGGER.info("testCallReader: {}", name);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean init(List<String> outputQueueList, RayActor peer, int msgCount) {
|
public boolean init(List<String> outputQueueList, RayActor<ReaderWorker> peer, int msgCount) {
|
||||||
|
|
||||||
this.outputQueueList = outputQueueList;
|
this.outputQueueList = outputQueueList;
|
||||||
this.peerActor = peer;
|
this.peerActor = peer;
|
||||||
|
@ -221,7 +218,7 @@ class WriterWorker extends Worker {
|
||||||
LOGGER.info("Peer isDirectActorCall: {}", ((NativeRayActor) peer).isDirectCallActor());
|
LOGGER.info("Peer isDirectActorCall: {}", ((NativeRayActor) peer).isDirectCallActor());
|
||||||
int count = 3;
|
int count = 3;
|
||||||
while (count-- != 0) {
|
while (count-- != 0) {
|
||||||
Ray.call(ReaderWorker::testRayCall, peer).get();
|
peer.call(ReaderWorker::testRayCall).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue