mirror of
https://github.com/wassname/ray.git
synced 2026-07-06 05:16:30 +08:00
Remove use of ObjectID transport flag (#7699)
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
package io.ray.api.test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import io.ray.api.Ray;
|
||||
import io.ray.api.RayObject;
|
||||
import io.ray.api.TestUtils;
|
||||
import io.ray.api.exception.RayException;
|
||||
import io.ray.api.id.ObjectId;
|
||||
import io.ray.runtime.RayNativeRuntime;
|
||||
import io.ray.runtime.object.RayObjectImpl;
|
||||
import io.ray.runtime.runner.RunManager;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ClientExceptionTest extends BaseTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ClientExceptionTest.class);
|
||||
|
||||
@Test
|
||||
public void testWaitAndCrash() {
|
||||
TestUtils.skipTestUnderSingleProcess();
|
||||
ObjectId randomId = ObjectId.fromRandom();
|
||||
RayObject<String> notExisting = new RayObjectImpl(randomId, String.class);
|
||||
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
// kill raylet
|
||||
RunManager runManager =
|
||||
((RayNativeRuntime) TestUtils.getUnderlyingRuntime()).getRunManager();
|
||||
for (Process process : runManager.getProcesses("raylet")) {
|
||||
runManager.terminateProcess("raylet", process);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("Got InterruptedException when sleeping, exit right now.");
|
||||
throw new RuntimeException("Got InterruptedException when sleeping.", e);
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
try {
|
||||
Ray.wait(ImmutableList.of(notExisting), 1, 2000);
|
||||
Assert.fail("Should not reach here");
|
||||
} catch (RayException e) {
|
||||
LOGGER.debug("Expected runtime exception: {}", e);
|
||||
}
|
||||
try {
|
||||
thread.join();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Excpetion caught: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,9 +84,12 @@ public class RayCallTest extends BaseTest {
|
||||
TestUtils.LargeObject largeObject = new TestUtils.LargeObject();
|
||||
Assert.assertNotNull(Ray.call(RayCallTest::testLargeObject, largeObject).get());
|
||||
|
||||
ObjectId randomObjectId = ObjectId.fromRandom();
|
||||
Ray.call(RayCallTest::testNoReturn, randomObjectId);
|
||||
Assert.assertEquals(((int) Ray.get(randomObjectId, Integer.class)), 1);
|
||||
// TODO(edoakes): this test doesn't work now that we've switched to direct call
|
||||
// mode. To make it work, we need to implement the same protocol for resolving
|
||||
// passed ObjectIDs that we have in Python.
|
||||
// ObjectId randomObjectId = ObjectId.fromRandom();
|
||||
// Ray.call(RayCallTest::testNoReturn, randomObjectId);
|
||||
// Assert.assertEquals(((int) Ray.get(randomObjectId, Integer.class)), 1);
|
||||
}
|
||||
|
||||
private static int testNoParam() {
|
||||
|
||||
Reference in New Issue
Block a user