mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 20:24:03 +08:00
[Java] Rename java ObjectRef/ActorHandle (#8799)
This commit is contained in:
@@ -73,7 +73,7 @@ public class TestUtils {
|
||||
* idle workers in Raylet's worker pool.
|
||||
*/
|
||||
public static void warmUpCluster() {
|
||||
RayObject<String> obj = Ray.call(TestUtils::hi);
|
||||
ObjectRef<String> obj = Ray.call(TestUtils::hi);
|
||||
Assert.assertEquals(obj.get(), "hi");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ActorPressTest extends RayBenchmarkTest {
|
||||
@@ -10,7 +10,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
@Test
|
||||
public void singleLatencyTest() {
|
||||
int times = 10;
|
||||
RayActor<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
ActorHandle<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
super.singleLatencyTest(times, adder);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
public void maxTest() {
|
||||
int clientNum = 2;
|
||||
int totalNum = 20;
|
||||
RayActor<ActorPressTest.Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
ActorHandle<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
PressureTestParameter pressureTestParameter = new PressureTestParameter();
|
||||
pressureTestParameter.setClientNum(clientNum);
|
||||
pressureTestParameter.setTotalNum(totalNum);
|
||||
@@ -32,7 +32,7 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
int clientNum = 2;
|
||||
int totalQps = 2;
|
||||
int duration = 3;
|
||||
RayActor<ActorPressTest.Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
ActorHandle<Adder> adder = Ray.createActor(ActorPressTest.Adder::new);
|
||||
PressureTestParameter pressureTestParameter = new PressureTestParameter();
|
||||
pressureTestParameter.setClientNum(clientNum);
|
||||
pressureTestParameter.setTotalQps(totalQps);
|
||||
@@ -43,8 +43,8 @@ public class ActorPressTest extends RayBenchmarkTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayObject<RemoteResult<Integer>> rayCall(RayActor rayActor) {
|
||||
return ((RayActor<Adder>) rayActor).call(Adder::add, 10);
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
return ((ActorHandle<Adder>) rayActor).call(Adder::add, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class MaxPressureTest extends RayBenchmarkTest {
|
||||
@@ -28,7 +28,7 @@ public class MaxPressureTest extends RayBenchmarkTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayObject<RemoteResult<Integer>> rayCall(RayActor rayActor) {
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
|
||||
return Ray.call(MaxPressureTest::currentTime);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.ActorHandle;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PressureTestParameter implements Serializable {
|
||||
@@ -19,7 +19,8 @@ public class PressureTestParameter implements Serializable {
|
||||
|
||||
private RayBenchmarkTest rayBenchmarkTest; //reference of current test case instance
|
||||
|
||||
private RayActor rayActor; // reference of the Actor, if only test remote funtion it could be null
|
||||
// reference of the Actor, if only test remote funtion it could be null
|
||||
private ActorHandle rayActor;
|
||||
|
||||
public Integer getClientNum() {
|
||||
return clientNum;
|
||||
@@ -69,11 +70,11 @@ public class PressureTestParameter implements Serializable {
|
||||
this.rayBenchmarkTest = rayBenchmarkTest;
|
||||
}
|
||||
|
||||
public RayActor getRayActor() {
|
||||
public ActorHandle getRayActor() {
|
||||
return rayActor;
|
||||
}
|
||||
|
||||
public void setRayActor(RayActor rayActor) {
|
||||
public void setRayActor(ActorHandle rayActor) {
|
||||
this.rayActor = rayActor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class RateLimiterPressureTest extends RayBenchmarkTest {
|
||||
@@ -30,7 +30,7 @@ public class RateLimiterPressureTest extends RayBenchmarkTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayObject<RemoteResult<Integer>> rayCall(RayActor rayActor) {
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
|
||||
return Ray.call(RateLimiterPressureTest::currentTime);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.function.RayFunc1;
|
||||
import io.ray.api.test.BaseTest;
|
||||
import java.io.Serializable;
|
||||
@@ -52,14 +52,14 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||
}
|
||||
RemoteResultWrapper temp = new RemoteResultWrapper();
|
||||
temp.setStartTime(System.nanoTime());
|
||||
temp.setRayObject(rayBenchmarkTest.rayCall(pressureTestParameter.getRayActor()));
|
||||
temp.setObjectRef(rayBenchmarkTest.rayCall(pressureTestParameter.getRayActor()));
|
||||
remoteResultWrappers[i++] = temp;
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
while (j < len) {
|
||||
RemoteResultWrapper temp = remoteResultWrappers[j++];
|
||||
RemoteResult remoteResult = (RemoteResult) temp.getRayObject().get();
|
||||
RemoteResult remoteResult = (RemoteResult) temp.getObjectRef().get();
|
||||
long endTime = remoteResult.getFinishTime();
|
||||
long costTime = endTime - temp.getStartTime();
|
||||
counterList.add(costTime / 1000);
|
||||
@@ -74,13 +74,13 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||
}
|
||||
}
|
||||
|
||||
public void singleLatencyTest(int times, RayActor rayActor) {
|
||||
public void singleLatencyTest(int times, ActorHandle rayActor) {
|
||||
|
||||
List<Long> counterList = new ArrayList<>();
|
||||
for (int i = 0; i < times; i++) {
|
||||
long startTime = System.nanoTime();
|
||||
RayObject<RemoteResult<T>> rayObject = rayCall(rayActor);
|
||||
RemoteResult<T> remoteResult = rayObject.get();
|
||||
ObjectRef<RemoteResult<T>> objectRef = rayCall(rayActor);
|
||||
RemoteResult<T> remoteResult = objectRef.get();
|
||||
T t = remoteResult.getResult();
|
||||
long endTime = System.nanoTime();
|
||||
long costTime = endTime - startTime;
|
||||
@@ -92,7 +92,7 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||
printList(counterList);
|
||||
}
|
||||
|
||||
public abstract RayObject<RemoteResult<T>> rayCall(RayActor rayActor);
|
||||
public abstract ObjectRef<RemoteResult<T>> rayCall(ActorHandle rayActor);
|
||||
|
||||
public abstract boolean checkResult(T t);
|
||||
|
||||
@@ -126,7 +126,7 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||
|
||||
List<Long> counterList = new ArrayList<>();
|
||||
int clientNum = pressureTestParameter.getClientNum();
|
||||
RayObject<List<Long>>[] rayObjects = new RayObject[clientNum];
|
||||
ObjectRef<List<Long>>[] objectRefs = new ObjectRef[clientNum];
|
||||
|
||||
for (int i = 0; i < clientNum; i++) {
|
||||
// Java compiler can't automatically infer the type of
|
||||
@@ -135,10 +135,10 @@ public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializab
|
||||
// defect of the Java compiler.
|
||||
// TODO(hchen): Figure out how to avoid manually declaring `RayFunc` type in this case.
|
||||
RayFunc1<PressureTestParameter, List<Long>> func = RayBenchmarkTest::singleClient;
|
||||
rayObjects[i] = Ray.call(func, pressureTestParameter);
|
||||
objectRefs[i] = Ray.call(func, pressureTestParameter);
|
||||
}
|
||||
for (int i = 0; i < clientNum; i++) {
|
||||
List<Long> subCounterList = rayObjects[i].get();
|
||||
List<Long> subCounterList = objectRefs[i].get();
|
||||
Assert.assertNotNull(subCounterList);
|
||||
counterList.addAll(subCounterList);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.ObjectRef;
|
||||
|
||||
public class RemoteResultWrapper<T> {
|
||||
|
||||
private long startTime;
|
||||
|
||||
private RayObject<RemoteResult<T>> rayObject;
|
||||
private ObjectRef<RemoteResult<T>> objectRef;
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
@@ -16,11 +16,11 @@ public class RemoteResultWrapper<T> {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public RayObject<RemoteResult<T>> getRayObject() {
|
||||
return rayObject;
|
||||
public ObjectRef<RemoteResult<T>> getObjectRef() {
|
||||
return objectRef;
|
||||
}
|
||||
|
||||
public void setRayObject(RayObject<RemoteResult<T>> rayObject) {
|
||||
this.rayObject = rayObject;
|
||||
public void setObjectRef(ObjectRef<RemoteResult<T>> objectRef) {
|
||||
this.objectRef = objectRef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.benchmark;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SingleLatencyTest extends RayBenchmarkTest {
|
||||
@@ -22,7 +22,7 @@ public class SingleLatencyTest extends RayBenchmarkTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayObject<RemoteResult<Integer>> rayCall(RayActor rayActor) {
|
||||
public ObjectRef<RemoteResult<Integer>> rayCall(ActorHandle rayActor) {
|
||||
return Ray.call(SingleLatencyTest::doFunc);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import java.util.List;
|
||||
@@ -35,10 +35,10 @@ public class ActorConcurrentCallTest extends BaseTest {
|
||||
ActorCreationOptions op = new ActorCreationOptions.Builder()
|
||||
.setMaxConcurrency(3)
|
||||
.createActorCreationOptions();
|
||||
RayActor<ConcurrentActor> actor = Ray.createActor(ConcurrentActor::new, op);
|
||||
RayObject<String> obj1 = actor.call(ConcurrentActor::countDown);
|
||||
RayObject<String> obj2 = actor.call(ConcurrentActor::countDown);
|
||||
RayObject<String> obj3 = actor.call(ConcurrentActor::countDown);
|
||||
ActorHandle<ConcurrentActor> actor = Ray.createActor(ConcurrentActor::new, op);
|
||||
ObjectRef<String> obj1 = actor.call(ConcurrentActor::countDown);
|
||||
ObjectRef<String> obj2 = actor.call(ConcurrentActor::countDown);
|
||||
ObjectRef<String> obj3 = actor.call(ConcurrentActor::countDown);
|
||||
|
||||
List<Integer> expectedResult = ImmutableList.of(1, 2, 3);
|
||||
Assert.assertEquals(obj1.get(), "ok");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.Checkpointable;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.exception.RayActorException;
|
||||
import io.ray.api.id.ActorId;
|
||||
@@ -46,7 +46,7 @@ public class ActorRestartTest extends BaseTest {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorCreationOptions options =
|
||||
new ActorCreationOptions.Builder().setMaxRestarts(1).createActorCreationOptions();
|
||||
RayActor<Counter> actor = Ray.createActor(Counter::new, options);
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, options);
|
||||
// Call increase 3 times.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
actor.call(Counter::increase).get();
|
||||
@@ -125,7 +125,7 @@ public class ActorRestartTest extends BaseTest {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ActorCreationOptions options =
|
||||
new ActorCreationOptions.Builder().setMaxRestarts(1).createActorCreationOptions();
|
||||
RayActor<CheckpointableCounter> actor = Ray.createActor(CheckpointableCounter::new, options);
|
||||
ActorHandle<CheckpointableCounter> actor = Ray.createActor(CheckpointableCounter::new, options);
|
||||
// Call increase 3 times.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
actor.call(CheckpointableCounter::increase).get();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.PyActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.RayPyActor;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.exception.UnreconstructableException;
|
||||
import io.ray.api.id.ActorId;
|
||||
@@ -47,10 +47,10 @@ public class ActorTest extends BaseTest {
|
||||
|
||||
public void testCreateAndCallActor() {
|
||||
// Test creating an actor from a constructor
|
||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
Assert.assertNotEquals(actor.getId(), ActorId.NIL);
|
||||
// A java actor is not a python actor
|
||||
Assert.assertFalse(actor instanceof RayPyActor);
|
||||
Assert.assertFalse(actor instanceof PyActorHandle);
|
||||
// Test calling an actor
|
||||
Assert.assertEquals(Integer.valueOf(1), actor.call(Counter::getValue).get());
|
||||
actor.call(Counter::increase, 1);
|
||||
@@ -64,8 +64,8 @@ public class ActorTest extends BaseTest {
|
||||
* get. To enable getting it twice, we cache the object in `RayObjectImpl`.
|
||||
*/
|
||||
public void testGetObjectTwice() {
|
||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
RayObject<Integer> result = actor.call(Counter::getValue);
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
ObjectRef<Integer> result = actor.call(Counter::getValue);
|
||||
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.
|
||||
@@ -73,7 +73,7 @@ public class ActorTest extends BaseTest {
|
||||
}
|
||||
|
||||
public void testCallActorWithLargeObject() {
|
||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 1);
|
||||
TestUtils.LargeObject largeObject = new TestUtils.LargeObject();
|
||||
Assert.assertEquals(Integer.valueOf(largeObject.data.length + 1),
|
||||
actor.call(Counter::accessLargeObject, largeObject).get());
|
||||
@@ -85,29 +85,29 @@ public class ActorTest extends BaseTest {
|
||||
|
||||
public void testCreateActorFromFactory() {
|
||||
// Test creating an actor from a factory method
|
||||
RayActor<Counter> actor = Ray.createActor(ActorTest::factory, 1);
|
||||
ActorHandle<Counter> actor = Ray.createActor(ActorTest::factory, 1);
|
||||
Assert.assertNotEquals(actor.getId(), UniqueId.NIL);
|
||||
// Test calling an actor
|
||||
Assert.assertEquals(Integer.valueOf(1), actor.call(Counter::getValue).get());
|
||||
}
|
||||
|
||||
static int testActorAsFirstParameter(RayActor<Counter> actor, int delta) {
|
||||
RayObject<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||
static int testActorAsFirstParameter(ActorHandle<Counter> actor, int delta) {
|
||||
ObjectRef<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||
return res.get();
|
||||
}
|
||||
|
||||
static int testActorAsSecondParameter(int delta, RayActor<Counter> actor) {
|
||||
RayObject<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||
static int testActorAsSecondParameter(int delta, ActorHandle<Counter> actor) {
|
||||
ObjectRef<Integer> res = actor.call(Counter::increaseAndGet, delta);
|
||||
return res.get();
|
||||
}
|
||||
|
||||
static int testActorAsFieldOfParameter(List<RayActor<Counter>> actor, int delta) {
|
||||
RayObject<Integer> res = actor.get(0).call(Counter::increaseAndGet, delta);
|
||||
static int testActorAsFieldOfParameter(List<ActorHandle<Counter>> actor, int delta) {
|
||||
ObjectRef<Integer> res = actor.get(0).call(Counter::increaseAndGet, delta);
|
||||
return res.get();
|
||||
}
|
||||
|
||||
public void testPassActorAsParameter() {
|
||||
RayActor<Counter> actor = Ray.createActor(Counter::new, 0);
|
||||
ActorHandle<Counter> actor = Ray.createActor(Counter::new, 0);
|
||||
Assert.assertEquals(Integer.valueOf(1),
|
||||
Ray.call(ActorTest::testActorAsFirstParameter, actor, 1).get());
|
||||
Assert.assertEquals(Integer.valueOf(11),
|
||||
@@ -123,9 +123,9 @@ public class ActorTest extends BaseTest {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
|
||||
// The UnreconstructableException is created by raylet.
|
||||
RayActor<Counter> counter = Ray.createActor(Counter::new, 100);
|
||||
ActorHandle<Counter> counter = Ray.createActor(Counter::new, 100);
|
||||
// Call an actor method.
|
||||
RayObject value = counter.call(Counter::getValue);
|
||||
ObjectRef value = counter.call(Counter::getValue);
|
||||
Assert.assertEquals(100, value.get());
|
||||
// Delete the object from the object store.
|
||||
Ray.internal().free(ImmutableList.of(value.getId()), false, false);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.BaseActor;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.BaseActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import io.ray.runtime.AbstractRayRuntime;
|
||||
@@ -93,18 +93,20 @@ public class ClassLoaderTest extends BaseTest {
|
||||
|
||||
// Compile the java file.
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
int result = compiler.run(null, null, null, "-d", jobResourcePath, javaFilePath);
|
||||
int result = compiler.run(null, null, null, "-d",
|
||||
jobResourcePath, javaFilePath);
|
||||
if (result != 0) {
|
||||
throw new RuntimeException("Couldn't compile ClassLoaderTester.java.");
|
||||
}
|
||||
|
||||
FunctionDescriptor constructor = new JavaFunctionDescriptor("ClassLoaderTester", "<init>",
|
||||
"()V");
|
||||
RayActor<?> actor1 = createActor(constructor);
|
||||
FunctionDescriptor getPid = new JavaFunctionDescriptor("ClassLoaderTester", "getPid", "()I");
|
||||
FunctionDescriptor constructor = new JavaFunctionDescriptor(
|
||||
"ClassLoaderTester", "<init>", "()V");
|
||||
ActorHandle<?> actor1 = createActor(constructor);
|
||||
FunctionDescriptor getPid = new JavaFunctionDescriptor(
|
||||
"ClassLoaderTester", "getPid", "()I");
|
||||
int pid = this.<Integer>callActorFunction(actor1, getPid, new Object[0],
|
||||
Optional.of(Integer.class)).get();
|
||||
RayActor<?> actor2;
|
||||
ActorHandle<?> actor2;
|
||||
while (true) {
|
||||
// Create another actor which share the same process of actor 1.
|
||||
actor2 = createActor(constructor);
|
||||
@@ -115,40 +117,42 @@ public class ClassLoaderTest extends BaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
FunctionDescriptor getClassLoaderHashCode = new JavaFunctionDescriptor("ClassLoaderTester",
|
||||
"getClassLoaderHashCode",
|
||||
"()I");
|
||||
RayObject<Integer> hashCode1 = callActorFunction(actor1, getClassLoaderHashCode, new Object[0],
|
||||
FunctionDescriptor getClassLoaderHashCode = new JavaFunctionDescriptor(
|
||||
"ClassLoaderTester", "getClassLoaderHashCode", "()I");
|
||||
ObjectRef<Integer> hashCode1 = callActorFunction(actor1, getClassLoaderHashCode, new Object[0],
|
||||
Optional.of(Integer.class));
|
||||
RayObject<Integer> hashCode2 = callActorFunction(actor2, getClassLoaderHashCode, new Object[0],
|
||||
ObjectRef<Integer> hashCode2 = callActorFunction(actor2, getClassLoaderHashCode, new Object[0],
|
||||
Optional.of(Integer.class));
|
||||
Assert.assertEquals(hashCode1.get(), hashCode2.get());
|
||||
|
||||
FunctionDescriptor increase = new JavaFunctionDescriptor("ClassLoaderTester", "increase",
|
||||
"()I");
|
||||
RayObject<Integer> value1 = callActorFunction(actor1, increase, new Object[0],
|
||||
FunctionDescriptor increase = new JavaFunctionDescriptor(
|
||||
"ClassLoaderTester", "increase", "()I");
|
||||
ObjectRef<Integer> value1 = callActorFunction(actor1, increase, new Object[0],
|
||||
Optional.of(Integer.class));
|
||||
RayObject<Integer> value2 = callActorFunction(actor2, increase, new Object[0],
|
||||
ObjectRef<Integer> value2 = callActorFunction(actor2, increase, new Object[0],
|
||||
Optional.of(Integer.class));
|
||||
Assert.assertNotEquals(value1.get(), value2.get());
|
||||
}
|
||||
|
||||
private RayActor<?> createActor(FunctionDescriptor functionDescriptor)
|
||||
private ActorHandle<?> createActor(FunctionDescriptor functionDescriptor)
|
||||
throws Exception {
|
||||
Method createActorMethod = AbstractRayRuntime.class.getDeclaredMethod("createActorImpl",
|
||||
FunctionDescriptor.class, Object[].class, ActorCreationOptions.class);
|
||||
createActorMethod.setAccessible(true);
|
||||
return (RayActor<?>) createActorMethod
|
||||
return (ActorHandle<?>) createActorMethod
|
||||
.invoke(TestUtils.getUnderlyingRuntime(), functionDescriptor, new Object[0], null);
|
||||
}
|
||||
|
||||
private <T> RayObject<T> callActorFunction(RayActor<?> rayActor,
|
||||
FunctionDescriptor functionDescriptor, Object[] args, Optional<Class<?>> returnType)
|
||||
private <T> ObjectRef<T> callActorFunction(
|
||||
ActorHandle<?> rayActor,
|
||||
FunctionDescriptor functionDescriptor,
|
||||
Object[] args,
|
||||
Optional<Class<?>> returnType)
|
||||
throws Exception {
|
||||
Method callActorFunctionMethod = AbstractRayRuntime.class.getDeclaredMethod("callActorFunction",
|
||||
BaseActor.class, FunctionDescriptor.class, Object[].class, Optional.class);
|
||||
BaseActorHandle.class, FunctionDescriptor.class, Object[].class, Optional.class);
|
||||
callActorFunctionMethod.setAccessible(true);
|
||||
return (RayObject<T>) callActorFunctionMethod
|
||||
return (ObjectRef<T>) callActorFunctionMethod
|
||||
.invoke(TestUtils.getUnderlyingRuntime(), rayActor, functionDescriptor, args, returnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@ package io.ray.api.test;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.PyActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.RayPyActor;
|
||||
import io.ray.api.function.PyActorClass;
|
||||
import io.ray.api.function.PyActorMethod;
|
||||
import io.ray.api.function.PyRemoteFunction;
|
||||
import io.ray.runtime.actor.NativeRayActor;
|
||||
import io.ray.runtime.actor.NativeRayPyActor;
|
||||
import io.ray.runtime.actor.NativeActorHandle;
|
||||
import io.ray.runtime.actor.NativePyActorHandle;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -69,7 +69,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
1.234, // Double
|
||||
"example binary".getBytes()}; // byte[]
|
||||
for (Object o : inputs) {
|
||||
RayObject res = Ray.call(
|
||||
ObjectRef res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", o.getClass()),
|
||||
o);
|
||||
Assert.assertEquals(res.get(), o);
|
||||
@@ -77,7 +77,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
// null
|
||||
{
|
||||
Object input = null;
|
||||
RayObject<Object> res = Ray.call(
|
||||
ObjectRef<Object> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", Object.class), input);
|
||||
Object r = res.get();
|
||||
Assert.assertEquals(r, input);
|
||||
@@ -85,7 +85,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
// array
|
||||
{
|
||||
int[] input = new int[]{1, 2};
|
||||
RayObject<int[]> res = Ray.call(
|
||||
ObjectRef<int[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", int[].class), input);
|
||||
int[] r = res.get();
|
||||
Assert.assertEquals(r, input);
|
||||
@@ -94,7 +94,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
{
|
||||
Object[] input = new Object[]{1, 2.3f, 4.56, "789", "10".getBytes(), null, true,
|
||||
new int[]{1, 2}};
|
||||
RayObject<Object[]> res = Ray.call(
|
||||
ObjectRef<Object[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input", Object[].class), input);
|
||||
Object[] r = res.get();
|
||||
// If we tell the value type is Object, then all numbers will be Number type.
|
||||
@@ -119,7 +119,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
{
|
||||
Assert.expectThrows(Exception.class, () -> {
|
||||
List<Integer> input = Arrays.asList(1, 2);
|
||||
RayObject<List<Integer>> res = Ray.call(
|
||||
ObjectRef<List<Integer>> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_return_input",
|
||||
(Class<List<Integer>>) input.getClass()), input);
|
||||
List<Integer> r = res.get();
|
||||
@@ -130,15 +130,16 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testPythonCallJavaFunction() {
|
||||
RayObject<String> res = Ray.call(
|
||||
ObjectRef<String> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_func_call_java_function", String.class));
|
||||
Assert.assertEquals(res.get(), "success");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallingPythonActor() {
|
||||
RayPyActor actor = Ray.createActor(new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes());
|
||||
RayObject<byte[]> res = actor.call(
|
||||
PyActorHandle actor = Ray.createActor(
|
||||
new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes());
|
||||
ObjectRef<byte[]> res = actor.call(
|
||||
new PyActorMethod<>("increase", byte[].class),
|
||||
"1".getBytes());
|
||||
Assert.assertEquals(res.get(), "2".getBytes());
|
||||
@@ -146,7 +147,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testPythonCallJavaActor() {
|
||||
RayObject<byte[]> res = Ray.call(
|
||||
ObjectRef<byte[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_func_call_java_actor", byte[].class),
|
||||
"1".getBytes());
|
||||
Assert.assertEquals(res.get(), "Counter1".getBytes());
|
||||
@@ -157,7 +158,7 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
public void testPassActorHandleFromPythonToJava() {
|
||||
// Call a python function which creates a python actor
|
||||
// and pass the actor handle to callPythonActorHandle.
|
||||
RayObject<byte[]> res = Ray.call(
|
||||
ObjectRef<byte[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE, "py_func_pass_python_actor_handle", byte[].class));
|
||||
Assert.assertEquals(res.get(), "3".getBytes());
|
||||
}
|
||||
@@ -165,20 +166,20 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
@Test
|
||||
public void testPassActorHandleFromJavaToPython() {
|
||||
// Create a java actor, and pass actor handle to python.
|
||||
RayActor<TestActor> javaActor = Ray.createActor(TestActor::new, "1".getBytes());
|
||||
Preconditions.checkState(javaActor instanceof NativeRayActor);
|
||||
byte[] actorHandleBytes = ((NativeRayActor) javaActor).toBytes();
|
||||
RayObject<byte[]> res = Ray.call(
|
||||
ActorHandle<TestActor> javaActor = Ray.createActor(TestActor::new, "1".getBytes());
|
||||
Preconditions.checkState(javaActor instanceof NativeActorHandle);
|
||||
byte[] actorHandleBytes = ((NativeActorHandle) javaActor).toBytes();
|
||||
ObjectRef<byte[]> res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE,
|
||||
"py_func_call_java_actor_from_handle",
|
||||
byte[].class),
|
||||
actorHandleBytes);
|
||||
Assert.assertEquals(res.get(), "12".getBytes());
|
||||
// Create a python actor, and pass actor handle to python.
|
||||
RayPyActor pyActor = Ray.createActor(
|
||||
PyActorHandle pyActor = Ray.createActor(
|
||||
new PyActorClass(PYTHON_MODULE, "Counter"), "1".getBytes());
|
||||
Preconditions.checkState(pyActor instanceof NativeRayActor);
|
||||
actorHandleBytes = ((NativeRayActor) pyActor).toBytes();
|
||||
Preconditions.checkState(pyActor instanceof NativeActorHandle);
|
||||
actorHandleBytes = ((NativeActorHandle) pyActor).toBytes();
|
||||
res = Ray.call(
|
||||
new PyRemoteFunction<>(PYTHON_MODULE,
|
||||
"py_func_call_python_actor_from_handle",
|
||||
@@ -218,8 +219,8 @@ public class CrossLanguageInvocationTest extends BaseMultiLanguageTest {
|
||||
|
||||
public static byte[] callPythonActorHandle(byte[] value) {
|
||||
// This function will be called from test_cross_language_invocation.py
|
||||
NativeRayPyActor actor = (NativeRayPyActor) NativeRayActor.fromBytes(value);
|
||||
RayObject<byte[]> res = actor.call(
|
||||
NativePyActorHandle actor = (NativePyActorHandle) NativeActorHandle.fromBytes(value);
|
||||
ObjectRef<byte[]> res = actor.call(
|
||||
new PyActorMethod<>("increase", byte[].class),
|
||||
"1".getBytes());
|
||||
Assert.assertEquals(res.get(), "3".getBytes());
|
||||
|
||||
@@ -2,8 +2,8 @@ package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.WaitResult;
|
||||
import io.ray.api.options.CallOptions;
|
||||
@@ -27,7 +27,7 @@ public class DynamicResourceTest extends BaseTest {
|
||||
|
||||
CallOptions op1 =
|
||||
new CallOptions.Builder().setResources(ImmutableMap.of("A", 10.0)).createCallOptions();
|
||||
RayObject<String> obj = Ray.call(DynamicResourceTest::sayHi, op1);
|
||||
ObjectRef<String> obj = Ray.call(DynamicResourceTest::sayHi, op1);
|
||||
WaitResult<String> result = Ray.wait(ImmutableList.of(obj), 1, 1000);
|
||||
Assert.assertEquals(result.getReady().size(), 0);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.exception.RayActorException;
|
||||
import io.ray.api.exception.RayException;
|
||||
@@ -71,9 +71,9 @@ public class FailureTest extends BaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertTaskFailedWithRayTaskException(RayObject<?> rayObject) {
|
||||
private static void assertTaskFailedWithRayTaskException(ObjectRef<?> objectRef) {
|
||||
try {
|
||||
rayObject.get();
|
||||
objectRef.get();
|
||||
Assert.fail("Task didn't fail.");
|
||||
} catch (RayTaskException e) {
|
||||
Throwable rootCause = e.getCause();
|
||||
@@ -94,14 +94,14 @@ public class FailureTest extends BaseTest {
|
||||
@Test
|
||||
public void testActorCreationFailure() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayActor<BadActor> actor = Ray.createActor(BadActor::new, true);
|
||||
ActorHandle<BadActor> actor = Ray.createActor(BadActor::new, true);
|
||||
assertTaskFailedWithRayTaskException(actor.call(BadActor::badMethod));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActorTaskFailure() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayActor<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||
ActorHandle<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||
assertTaskFailedWithRayTaskException(actor.call(BadActor::badMethod));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class FailureTest extends BaseTest {
|
||||
@Test
|
||||
public void testActorProcessDying() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayActor<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||
ActorHandle<BadActor> actor = Ray.createActor(BadActor::new, false);
|
||||
try {
|
||||
actor.call(BadActor::badMethod2).get();
|
||||
Assert.fail("This line shouldn't be reached.");
|
||||
@@ -144,8 +144,8 @@ public class FailureTest extends BaseTest {
|
||||
FailureTest::badFunc2);
|
||||
TestUtils.warmUpCluster();
|
||||
for (RayFunc0<Integer> badFunc : badFunctions) {
|
||||
RayObject<Integer> obj1 = Ray.call(badFunc);
|
||||
RayObject<Integer> obj2 = Ray.call(FailureTest::slowFunc);
|
||||
ObjectRef<Integer> obj1 = Ray.call(badFunc);
|
||||
ObjectRef<Integer> obj2 = Ray.call(FailureTest::slowFunc);
|
||||
Instant start = Instant.now();
|
||||
try {
|
||||
Ray.get(Arrays.asList(obj1, obj2));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -24,8 +24,8 @@ public class HelloWorldTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testHelloWorld() {
|
||||
RayObject<String> hello = Ray.call(HelloWorldTest::hello);
|
||||
RayObject<String> world = Ray.call(HelloWorldTest::world);
|
||||
ObjectRef<String> hello = Ray.call(HelloWorldTest::hello);
|
||||
ObjectRef<String> world = Ray.call(HelloWorldTest::world);
|
||||
String helloWorld = Ray.call(HelloWorldTest::merge, hello, world).get();
|
||||
Assert.assertEquals("hello,world!", helloWorld);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.exception.RayActorException;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
@@ -41,27 +41,27 @@ public class KillActorTest extends BaseTest {
|
||||
|
||||
public static class KillerActor {
|
||||
|
||||
public void kill(RayActor<?> actor, boolean noRestart) {
|
||||
public void kill(ActorHandle<?> actor, boolean noRestart) {
|
||||
actor.kill(noRestart);
|
||||
}
|
||||
}
|
||||
|
||||
private static void localKill(RayActor<?> actor, boolean noRestart) {
|
||||
private static void localKill(ActorHandle<?> actor, boolean noRestart) {
|
||||
actor.kill(noRestart);
|
||||
}
|
||||
|
||||
private static void remoteKill(RayActor<?> actor, boolean noRestart) {
|
||||
RayActor<KillerActor> killer = Ray.createActor(KillerActor::new);
|
||||
private static void remoteKill(ActorHandle<?> actor, boolean noRestart) {
|
||||
ActorHandle<KillerActor> killer = Ray.createActor(KillerActor::new);
|
||||
killer.call(KillerActor::kill, actor, noRestart);
|
||||
}
|
||||
|
||||
private void testKillActor(BiConsumer<RayActor<?>, Boolean> kill, boolean noRestart) {
|
||||
private void testKillActor(BiConsumer<ActorHandle<?>, Boolean> kill, boolean noRestart) {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
|
||||
ActorCreationOptions options =
|
||||
new ActorCreationOptions.Builder().setMaxRestarts(1).createActorCreationOptions();
|
||||
RayActor<HangActor> actor = Ray.createActor(HangActor::new, options);
|
||||
RayObject<Boolean> result = actor.call(HangActor::hang);
|
||||
ActorHandle<HangActor> actor = Ray.createActor(HangActor::new, options);
|
||||
ObjectRef<Boolean> result = actor.call(HangActor::hang);
|
||||
// The actor will hang in this task.
|
||||
Assert.assertEquals(0, Ray.wait(ImmutableList.of(result), 1, 500).getReady().size());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class MultiLanguageClusterTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testMultiLanguageCluster() {
|
||||
RayObject<String> obj = Ray.call(MultiLanguageClusterTest::echo, "hello");
|
||||
ObjectRef<String> obj = Ray.call(MultiLanguageClusterTest::echo, "hello");
|
||||
Assert.assertEquals("hello", obj.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.WaitResult;
|
||||
import io.ray.api.exception.RayException;
|
||||
@@ -73,22 +73,22 @@ public class MultiThreadingTest extends BaseTest {
|
||||
// Test calling normal functions.
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
RayObject<Integer> obj = Ray.call(MultiThreadingTest::echo, arg);
|
||||
ObjectRef<Integer> obj = Ray.call(MultiThreadingTest::echo, arg);
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, LOOP_COUNTER);
|
||||
|
||||
// Test calling actors.
|
||||
RayActor<Echo> echoActor = Ray.createActor(Echo::new);
|
||||
ActorHandle<Echo> echoActor = Ray.createActor(Echo::new);
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
RayObject<Integer> obj = echoActor.call(Echo::echo, arg);
|
||||
ObjectRef<Integer> obj = echoActor.call(Echo::echo, arg);
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, LOOP_COUNTER);
|
||||
|
||||
// Test creating multi actors
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
RayActor<Echo> echoActor1 = Ray.createActor(Echo::new);
|
||||
ActorHandle<Echo> echoActor1 = Ray.createActor(Echo::new);
|
||||
try {
|
||||
// Sleep a while to test the case that another actor is created before submitting
|
||||
// tasks to this actor.
|
||||
@@ -96,20 +96,20 @@ public class MultiThreadingTest extends BaseTest {
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.warn("Got exception while sleeping.", e);
|
||||
}
|
||||
RayObject<Integer> obj = echoActor1.call(Echo::echo, arg);
|
||||
ObjectRef<Integer> obj = echoActor1.call(Echo::echo, arg);
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, 1);
|
||||
|
||||
// Test put and get.
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
int arg = random.nextInt();
|
||||
RayObject<Integer> obj = Ray.put(arg);
|
||||
ObjectRef<Integer> obj = Ray.put(arg);
|
||||
Assert.assertEquals(arg, (int) obj.get());
|
||||
}, LOOP_COUNTER);
|
||||
|
||||
TestUtils.warmUpCluster();
|
||||
// Test wait for one object in multi threads.
|
||||
RayObject<Integer> obj = Ray.call(MultiThreadingTest::echo, 100);
|
||||
ObjectRef<Integer> obj = Ray.call(MultiThreadingTest::echo, 100);
|
||||
runTestCaseInMultipleThreads(() -> {
|
||||
WaitResult<Integer> result = Ray.wait(ImmutableList.of(obj), 1, 1000);
|
||||
Assert.assertEquals(1, result.getReady().size());
|
||||
@@ -125,23 +125,23 @@ public class MultiThreadingTest extends BaseTest {
|
||||
public void testInWorker() {
|
||||
// Single-process mode doesn't have real workers.
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayObject<String> obj = Ray.call(MultiThreadingTest::testMultiThreading);
|
||||
ObjectRef<String> obj = Ray.call(MultiThreadingTest::testMultiThreading);
|
||||
Assert.assertEquals("ok", obj.get());
|
||||
}
|
||||
|
||||
public void testGetCurrentActorId() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayActor<ActorIdTester> actorIdTester = Ray.createActor(ActorIdTester::new);
|
||||
ActorHandle<ActorIdTester> actorIdTester = Ray.createActor(ActorIdTester::new);
|
||||
ActorId actorId = actorIdTester.call(ActorIdTester::getCurrentActorId).get();
|
||||
Assert.assertEquals(actorId, actorIdTester.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method each time to avoid hitting the cache in {@link RayObject#get()}.
|
||||
* Call this method each time to avoid hitting the cache in {@link ObjectRef#get()}.
|
||||
*/
|
||||
static Runnable[] generateRunnables() {
|
||||
final RayObject<Integer> fooObject = Ray.put(1);
|
||||
final RayActor<Echo> fooActor = Ray.createActor(Echo::new);
|
||||
final ObjectRef<Integer> fooObject = Ray.put(1);
|
||||
final ActorHandle<Echo> fooActor = Ray.createActor(Echo::new);
|
||||
return new Runnable[]{
|
||||
() -> Ray.put(1),
|
||||
() -> Ray.get(fooObject.getId(), fooObject.getType()),
|
||||
@@ -219,7 +219,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
runnables[0].run();
|
||||
}
|
||||
|
||||
// Return true here to make the Ray.call returns an RayObject.
|
||||
// Return true here to make the Ray.call returns an ObjectRef.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ public class MultiThreadingTest extends BaseTest {
|
||||
}
|
||||
|
||||
public void testGetAsyncContextAndSetAsyncContextInWorker() {
|
||||
RayObject<Boolean> obj = Ray.call(MultiThreadingTest::testGetAsyncContextAndSetAsyncContext);
|
||||
ObjectRef<Boolean> obj = Ray.call(MultiThreadingTest::testGetAsyncContextAndSetAsyncContext);
|
||||
Assert.assertTrue(obj.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.id.ObjectId;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -17,19 +17,19 @@ public class ObjectStoreTest extends BaseTest {
|
||||
@Test
|
||||
public void testPutAndGet() {
|
||||
{
|
||||
RayObject<Integer> obj = Ray.put(1);
|
||||
ObjectRef<Integer> obj = Ray.put(1);
|
||||
Assert.assertEquals(1, (int) obj.get());
|
||||
}
|
||||
|
||||
{
|
||||
String s = null;
|
||||
RayObject<String> obj = Ray.put(s);
|
||||
ObjectRef<String> obj = Ray.put(s);
|
||||
Assert.assertNull(obj.get());
|
||||
}
|
||||
|
||||
{
|
||||
List<List<String>> l = ImmutableList.of(ImmutableList.of("abc"));
|
||||
RayObject<List<List<String>>> obj = Ray.put(l);
|
||||
ObjectRef<List<List<String>>> obj = Ray.put(l);
|
||||
Assert.assertEquals(obj.get(), l);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.id.TaskId;
|
||||
import java.util.Arrays;
|
||||
@@ -17,7 +17,7 @@ public class PlasmaFreeTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testDeleteObjects() {
|
||||
RayObject<String> helloId = Ray.call(PlasmaFreeTest::hello);
|
||||
ObjectRef<String> helloId = Ray.call(PlasmaFreeTest::hello);
|
||||
String helloString = helloId.get();
|
||||
Assert.assertEquals("hello", helloString);
|
||||
Ray.internal().free(ImmutableList.of(helloId.getId()), true, false);
|
||||
@@ -36,7 +36,7 @@ public class PlasmaFreeTest extends BaseTest {
|
||||
@Test
|
||||
public void testDeleteCreatingTasks() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayObject<String> helloId = Ray.call(PlasmaFreeTest::hello);
|
||||
ObjectRef<String> helloId = Ray.call(PlasmaFreeTest::hello);
|
||||
Assert.assertEquals("hello", helloId.get());
|
||||
Ray.internal().free(ImmutableList.of(helloId.getId()), true, true);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.WaitResult;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -16,15 +16,15 @@ public class RayMethodsTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
RayObject<Integer> i1Id = Ray.put(1);
|
||||
RayObject<Double> f1Id = Ray.put(3.14);
|
||||
RayObject<String> s1Id = Ray.put(String.valueOf("Hello "));
|
||||
RayObject<String> s2Id = Ray.put(String.valueOf("World!"));
|
||||
RayObject<Object> n1Id = Ray.put(null);
|
||||
ObjectRef<Integer> i1Id = Ray.put(1);
|
||||
ObjectRef<Double> f1Id = Ray.put(3.14);
|
||||
ObjectRef<String> s1Id = Ray.put(String.valueOf("Hello "));
|
||||
ObjectRef<String> s2Id = Ray.put(String.valueOf("World!"));
|
||||
ObjectRef<Object> n1Id = Ray.put(null);
|
||||
|
||||
WaitResult<String> res = Ray.wait(ImmutableList.of(s1Id, s2Id), 2, 1000);
|
||||
|
||||
List<String> ss = res.getReady().stream().map(RayObject::get).collect(Collectors.toList());
|
||||
List<String> ss = res.getReady().stream().map(ObjectRef::get).collect(Collectors.toList());
|
||||
int i1 = i1Id.get();
|
||||
double f1 = f1Id.get();
|
||||
Object n1 = n1Id.get();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.PyActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayPyActor;
|
||||
import io.ray.api.function.PyActorClass;
|
||||
import io.ray.runtime.object.NativeRayObject;
|
||||
import io.ray.runtime.object.ObjectSerializer;
|
||||
@@ -12,9 +12,10 @@ public class RaySerializerTest extends BaseMultiLanguageTest {
|
||||
|
||||
@Test
|
||||
public void testSerializePyActor() {
|
||||
RayPyActor pyActor = Ray.createActor(new PyActorClass("test", "RaySerializerTest"));
|
||||
PyActorHandle pyActor = Ray.createActor(
|
||||
new PyActorClass("test", "RaySerializerTest"));
|
||||
NativeRayObject nativeRayObject = ObjectSerializer.serialize(pyActor);
|
||||
RayPyActor result = (RayPyActor) ObjectSerializer
|
||||
PyActorHandle result = (PyActorHandle) ObjectSerializer
|
||||
.deserialize(nativeRayObject, null, Object.class);
|
||||
Assert.assertEquals(result.getId(), pyActor.getId());
|
||||
Assert.assertEquals(result.getModuleName(), "test");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.TestUtils;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterClass;
|
||||
@@ -32,7 +32,7 @@ public class RayletConfigTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRayletConfigPassThrough() {
|
||||
RayActor<TestActor> actor = Ray.createActor(TestActor::new);
|
||||
ActorHandle<TestActor> actor = Ray.createActor(TestActor::new);
|
||||
String configValue = actor.call(TestActor::getConfigValue).get();
|
||||
Assert.assertEquals(configValue, RAY_CONFIG_VALUE);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@@ -27,7 +27,7 @@ public class RedisPasswordTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRedisPassword() {
|
||||
RayObject<String> obj = Ray.call(RedisPasswordTest::echo, "hello");
|
||||
ObjectRef<String> obj = Ray.call(RedisPasswordTest::echo, "hello");
|
||||
Assert.assertEquals("hello", obj.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.WaitResult;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
@@ -48,7 +48,7 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
|
||||
// This is a case that can satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
RayObject<Integer> result1 = Ray.call(ResourcesManagementTest::echo, 100, callOptions1);
|
||||
ObjectRef<Integer> result1 = Ray.call(ResourcesManagementTest::echo, 100, callOptions1);
|
||||
Assert.assertEquals(100, (int) result1.get());
|
||||
|
||||
CallOptions callOptions2 =
|
||||
@@ -56,7 +56,7 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
|
||||
// This is a case that can't satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
final RayObject<Integer> result2 = Ray.call(ResourcesManagementTest::echo, 200, callOptions2);
|
||||
final ObjectRef<Integer> result2 = Ray.call(ResourcesManagementTest::echo, 200, callOptions2);
|
||||
WaitResult<Integer> waitResult = Ray.wait(ImmutableList.of(result2), 1, 1000);
|
||||
|
||||
Assert.assertEquals(1, waitResult.getReady().size());
|
||||
@@ -80,8 +80,8 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
.setResources(ImmutableMap.of("CPU", 2.0)).createActorCreationOptions();
|
||||
// This is a case that can satisfy required resources.
|
||||
// The static resources for test are "CPU:4,RES-A:4".
|
||||
RayActor<Echo> echo1 = Ray.createActor(Echo::new, actorCreationOptions1);
|
||||
final RayObject<Integer> result1 = echo1.call(Echo::echo, 100);
|
||||
ActorHandle<Echo> echo1 = Ray.createActor(Echo::new, actorCreationOptions1);
|
||||
final ObjectRef<Integer> result1 = echo1.call(Echo::echo, 100);
|
||||
Assert.assertEquals(100, (int) result1.get());
|
||||
|
||||
// This is a case that can't satisfy required resources.
|
||||
@@ -89,9 +89,9 @@ public class ResourcesManagementTest extends BaseTest {
|
||||
ActorCreationOptions actorCreationOptions2 = new ActorCreationOptions.Builder()
|
||||
.setResources(ImmutableMap.of("CPU", 8.0)).createActorCreationOptions();
|
||||
|
||||
RayActor<ResourcesManagementTest.Echo> echo2 =
|
||||
ActorHandle<Echo> echo2 =
|
||||
Ray.createActor(Echo::new, actorCreationOptions2);
|
||||
final RayObject<Integer> result2 = echo2.call(Echo::echo, 100);
|
||||
final ObjectRef<Integer> result2 = echo2.call(Echo::echo, 100);
|
||||
WaitResult<Integer> waitResult = Ray.wait(ImmutableList.of(result2), 1, 1000);
|
||||
|
||||
Assert.assertEquals(0, waitResult.getReady().size());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.id.ActorId;
|
||||
import io.ray.api.id.JobId;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -60,7 +60,7 @@ public class RuntimeContextTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testRuntimeContextInActor() {
|
||||
RayActor<RuntimeContextTester> actor = Ray.createActor(RuntimeContextTester::new);
|
||||
ActorHandle<RuntimeContextTester> actor = Ray.createActor(RuntimeContextTester::new);
|
||||
Assert.assertEquals("ok",
|
||||
actor.call(RuntimeContextTester::testRuntimeContext, actor.getId()).get());
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.id.ActorId;
|
||||
import java.util.ArrayList;
|
||||
@@ -31,18 +31,18 @@ public class SingleProcessModeTest extends BaseTest {
|
||||
public void testActorTasksInOneThread() {
|
||||
TestUtils.skipTestUnderClusterMode();
|
||||
|
||||
List<RayActor<MyActor>> actors = new ArrayList<>();
|
||||
List<ActorHandle<MyActor>> actors = new ArrayList<>();
|
||||
Map<ActorId, Long> actorThreadIds = new HashMap<>();
|
||||
for (int i = 0; i < NUM_ACTOR_INSTANCE; ++i) {
|
||||
RayActor<MyActor> actor = Ray.createActor(MyActor::new);
|
||||
ActorHandle<MyActor> actor = Ray.createActor(MyActor::new);
|
||||
actors.add(actor);
|
||||
actorThreadIds.put(actor.getId(), actor.call(MyActor::getThreadId).get());
|
||||
}
|
||||
|
||||
Map<ActorId, List<RayObject<Long>>> allResults = new HashMap<>();
|
||||
Map<ActorId, List<ObjectRef<Long>>> allResults = new HashMap<>();
|
||||
for (int i = 0; i < NUM_ACTOR_INSTANCE; ++i) {
|
||||
final RayActor<MyActor> actor = actors.get(i);
|
||||
List<RayObject<Long>> thisActorResult = new ArrayList<>();
|
||||
final ActorHandle<MyActor> actor = actors.get(i);
|
||||
List<ObjectRef<Long>> thisActorResult = new ArrayList<>();
|
||||
for (int j = 0; j < TIMES_TO_CALL_PER_ACTOR; ++j) {
|
||||
thisActorResult.add(actor.call(MyActor::getThreadId));
|
||||
}
|
||||
@@ -51,10 +51,10 @@ public class SingleProcessModeTest extends BaseTest {
|
||||
|
||||
// check result.
|
||||
for (int i = 0; i < NUM_ACTOR_INSTANCE; ++i) {
|
||||
final RayActor<MyActor> actor = actors.get(i);
|
||||
final List<RayObject<Long>> thisActorResult = allResults.get(actor.getId());
|
||||
final ActorHandle<MyActor> actor = actors.get(i);
|
||||
final List<ObjectRef<Long>> thisActorResult = allResults.get(actor.getId());
|
||||
// assert
|
||||
for (RayObject<Long> threadId : thisActorResult) {
|
||||
for (ObjectRef<Long> threadId : thisActorResult) {
|
||||
Assert.assertEquals(threadId.get(), actorThreadIds.get(actor.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.id.ObjectId;
|
||||
import java.util.ArrayList;
|
||||
@@ -38,7 +38,7 @@ public class StressTest extends BaseTest {
|
||||
@Test
|
||||
public void testDependency() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayObject<Integer> x = Ray.call(StressTest::echo, 1);
|
||||
ObjectRef<Integer> x = Ray.call(StressTest::echo, 1);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
x = Ray.call(StressTest::echo, x);
|
||||
}
|
||||
@@ -55,9 +55,9 @@ public class StressTest extends BaseTest {
|
||||
|
||||
public static class Worker {
|
||||
|
||||
private RayActor<Actor> actor;
|
||||
private ActorHandle<Actor> actor;
|
||||
|
||||
public Worker(RayActor<Actor> actor) {
|
||||
public Worker(ActorHandle<Actor> actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
@@ -77,10 +77,10 @@ public class StressTest extends BaseTest {
|
||||
@Test
|
||||
public void testSubmittingManyTasksToOneActor() throws Exception {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
RayActor<Actor> actor = Ray.createActor(Actor::new);
|
||||
ActorHandle<Actor> actor = Ray.createActor(Actor::new);
|
||||
List<ObjectId> objectIds = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
RayActor<Worker> worker = Ray.createActor(Worker::new, actor);
|
||||
ActorHandle<Worker> worker = Ray.createActor(Worker::new, actor);
|
||||
objectIds.add(worker.call(Worker::ping, 100).getId());
|
||||
}
|
||||
|
||||
@@ -93,12 +93,12 @@ public class StressTest extends BaseTest {
|
||||
public void testPuttingAndGettingManyObjects() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
Integer objectToPut = 1;
|
||||
List<RayObject<Integer>> objects = new ArrayList<>();
|
||||
List<ObjectRef<Integer>> objects = new ArrayList<>();
|
||||
for (int i = 0; i < 100_000; i++) {
|
||||
objects.add(Ray.put(objectToPut));
|
||||
}
|
||||
|
||||
for (RayObject<Integer> object : objects) {
|
||||
for (ObjectRef<Integer> object : objects) {
|
||||
Assert.assertEquals(object.get(), objectToPut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.WaitResult;
|
||||
import java.util.ArrayList;
|
||||
@@ -29,13 +29,13 @@ public class WaitTest extends BaseTest {
|
||||
// Call a task in advance to warm up the cluster to avoid being too slow to start workers.
|
||||
TestUtils.warmUpCluster();
|
||||
|
||||
RayObject<String> obj1 = Ray.call(WaitTest::hi);
|
||||
RayObject<String> obj2 = Ray.call(WaitTest::delayedHi);
|
||||
ObjectRef<String> obj1 = Ray.call(WaitTest::hi);
|
||||
ObjectRef<String> obj2 = Ray.call(WaitTest::delayedHi);
|
||||
|
||||
List<RayObject<String>> waitList = ImmutableList.of(obj1, obj2);
|
||||
List<ObjectRef<String>> waitList = ImmutableList.of(obj1, obj2);
|
||||
WaitResult<String> waitResult = Ray.wait(waitList, 2, 2 * 1000);
|
||||
|
||||
List<RayObject<String>> readyList = waitResult.getReady();
|
||||
List<ObjectRef<String>> readyList = waitResult.getReady();
|
||||
|
||||
Assert.assertEquals(1, waitResult.getReady().size());
|
||||
Assert.assertEquals(1, waitResult.getUnready().size());
|
||||
@@ -54,7 +54,7 @@ public class WaitTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testWaitInWorker() {
|
||||
RayObject<Object> res = Ray.call(WaitTest::waitInWorker);
|
||||
ObjectRef<Object> res = Ray.call(WaitTest::waitInWorker);
|
||||
res.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import io.ray.api.ActorHandle;
|
||||
import io.ray.api.ObjectRef;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayActor;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.options.ActorCreationOptions;
|
||||
import org.testng.Assert;
|
||||
@@ -24,8 +24,8 @@ public class WorkerJvmOptionsTest extends BaseTest {
|
||||
// that raylet can correctly handle dynamic options with whitespaces.
|
||||
.setJvmOptions(" -Dtest.suffix=suffix -Dtest.suffix1=suffix1 ")
|
||||
.createActorCreationOptions();
|
||||
RayActor<Echo> actor = Ray.createActor(Echo::new, options);
|
||||
RayObject<String> obj = actor.call(Echo::getOptions);
|
||||
ActorHandle<Echo> actor = Ray.createActor(Echo::new, options);
|
||||
ObjectRef<String> obj = actor.call(Echo::getOptions);
|
||||
Assert.assertEquals(obj.get(), "suffix");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user