mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 06:49:48 +08:00
Fix duplicated timeout logic in AbstractRayRuntime.get() (#5338)
This commit is contained in:
@@ -11,7 +11,7 @@ import org.ray.api.exception.UnreconstructableException;
|
||||
import org.ray.api.id.UniqueId;
|
||||
import org.ray.runtime.AbstractRayRuntime;
|
||||
import org.ray.runtime.RayActorImpl;
|
||||
import org.ray.runtime.objectstore.ObjectStoreProxy.GetResult;
|
||||
import org.ray.runtime.objectstore.NativeRayObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -100,9 +100,10 @@ public class ActorTest extends BaseTest {
|
||||
Ray.internal().free(ImmutableList.of(value.getId()), false, false);
|
||||
// Wait until the object is deleted, because the above free operation is async.
|
||||
while (true) {
|
||||
GetResult<Integer> result = ((AbstractRayRuntime)
|
||||
Ray.internal()).getObjectStoreProxy().get(value.getId(), 0);
|
||||
if (!result.exists) {
|
||||
NativeRayObject result = ((AbstractRayRuntime)
|
||||
Ray.internal()).getObjectStoreProxy().getObjectInterface()
|
||||
.get(ImmutableList.of(value.getId()), 0).get(0);
|
||||
if (result == null) {
|
||||
break;
|
||||
}
|
||||
TimeUnit.MILLISECONDS.sleep(100);
|
||||
|
||||
@@ -23,8 +23,9 @@ public class PlasmaFreeTest extends BaseTest {
|
||||
Assert.assertEquals("hello", helloString);
|
||||
Ray.internal().free(ImmutableList.of(helloId.getId()), true, false);
|
||||
|
||||
final boolean result = TestUtils.waitForCondition(() -> !((AbstractRayRuntime) Ray.internal())
|
||||
.getObjectStoreProxy().get(helloId.getId(), 0).exists, 50);
|
||||
final boolean result = TestUtils.waitForCondition(() ->
|
||||
((AbstractRayRuntime) Ray.internal()).getObjectStoreProxy().getObjectInterface()
|
||||
.get(ImmutableList.of(helloId.getId()), 0).get(0) == null, 50);
|
||||
Assert.assertTrue(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ public class PlasmaStoreTest extends BaseTest {
|
||||
AbstractRayRuntime runtime = (AbstractRayRuntime) Ray.internal();
|
||||
ObjectStoreProxy objectInterface = runtime.getObjectStoreProxy();
|
||||
objectInterface.put(objectId, 1);
|
||||
Assert.assertEquals(objectInterface.<Integer>get(objectId, -1).object, (Integer) 1);
|
||||
Assert.assertEquals(objectInterface.<Integer>get(objectId), (Integer) 1);
|
||||
objectInterface.put(objectId, 2);
|
||||
// Putting 2 objects with duplicate ID should fail but ignored.
|
||||
Assert.assertEquals(objectInterface.<Integer>get(objectId, -1).object, (Integer) 1);
|
||||
Assert.assertEquals(objectInterface.<Integer>get(objectId), (Integer) 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user