mirror of
https://github.com/wassname/ray.git
synced 2026-07-05 05:22:26 +08:00
[Java] Throw exception if Ray.init() is not called and users try to access ray API (#10497)
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ class ClusterStarter {
|
||||
private static final String RAYLET_SOCKET_NAME = "/tmp/ray/raylet_socket";
|
||||
|
||||
static synchronized void startCluster(boolean isCrossLanguage, boolean isLocal) {
|
||||
Preconditions.checkArgument(Ray.internal() == null);
|
||||
Preconditions.checkArgument(!Ray.isInitialized());
|
||||
RayConfig.reset();
|
||||
if (!isLocal) {
|
||||
System.setProperty("ray.raylet.config.num_workers_per_process_java", "1");
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ public class StreamingContext implements Serializable {
|
||||
jobGraph.printJobGraph();
|
||||
LOG.info("JobGraph digraph\n{}", jobGraph.generateDigraph());
|
||||
|
||||
if (Ray.internal() == null) {
|
||||
if (!Ray.isInitialized()) {
|
||||
if (Config.MEMORY_CHANNEL.equalsIgnoreCase(jobConfig.get(Config.CHANNEL_TYPE))) {
|
||||
Preconditions.checkArgument(!jobGraph.isCrossLanguageGraph());
|
||||
ClusterStarter.startCluster(false, true);
|
||||
@@ -102,7 +102,7 @@ public class StreamingContext implements Serializable {
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (Ray.internal() != null) {
|
||||
if (Ray.isInitialized()) {
|
||||
ClusterStarter.stopCluster(jobGraph.isCrossLanguageGraph());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user