Java doc: "Starting Ray" page (#10062)

This commit is contained in:
Kai Yang
2020-09-05 10:15:52 +08:00
committed by GitHub
parent 7ee0fdba3d
commit 6a78ba9752
4 changed files with 166 additions and 35 deletions
+9 -1
View File
@@ -37,7 +37,7 @@ public final class Ray extends RayCall {
*
* @param factory A factory that produces the runtime instance.
*/
public static synchronized void init(RayRuntimeFactory factory) {
private static synchronized void init(RayRuntimeFactory factory) {
if (runtime == null) {
runtime = factory.createRayRuntime();
Runtime.getRuntime().addShutdownHook(new Thread(Ray::shutdown));
@@ -54,6 +54,14 @@ public final class Ray extends RayCall {
}
}
/**
* Check if {@link #init} has been called yet.
* @return True if {@link #init} has already been called and false otherwise.
*/
public static boolean isInitialized() {
return runtime != null;
}
/**
* Store an object in the object store.
*
@@ -130,7 +130,11 @@ public class RayConfig {
workerMode = localWorkerMode;
boolean isDriver = workerMode == WorkerType.DRIVER;
// Run mode.
runMode = config.getEnum(RunMode.class, "ray.run-mode");
if (config.hasPath("ray.local-mode")) {
runMode = config.getBoolean("ray.local-mode") ? RunMode.SINGLE_PROCESS : RunMode.CLUSTER;
} else {
runMode = config.getEnum(RunMode.class, "ray.run-mode");
}
// Node ip.
if (config.hasPath("ray.node-ip")) {
nodeIp = config.getString("ray.node-ip");