[Java] Throw exception if Ray.init() is not called and users try to access ray API (#10497)

This commit is contained in:
chaokunyang
2020-09-05 10:09:19 +08:00
committed by GitHub
parent 8ee7c182f5
commit 7ee0fdba3d
6 changed files with 35 additions and 26 deletions
@@ -91,7 +91,7 @@ public abstract class BaseMultiLanguageTest {
}
// Connect to the cluster.
Assert.assertNull(Ray.internal());
Assert.assertFalse(Ray.isInitialized());
System.setProperty("ray.redis.address", "127.0.0.1:6379");
System.setProperty("ray.object-store.socket-name", PLASMA_STORE_SOCKET_NAME);
System.setProperty("ray.raylet.socket-name", RAYLET_SOCKET_NAME);
@@ -19,7 +19,7 @@ public class BaseTest {
@BeforeMethod(alwaysRun = true)
public void setUpBase(Method method) {
Assert.assertNull(Ray.internal());
Assert.assertFalse(Ray.isInitialized());
Ray.init();
// These files need to be deleted after each test case.
filesToDelete = ImmutableList.of(