mirror of
https://github.com/wassname/ray.git
synced 2026-07-03 01:09:13 +08:00
Better checking that ray.init() has been called. (#10261)
This commit is contained in:
+5
-11
@@ -46,17 +46,11 @@ class GlobalState:
|
||||
RuntimeError: An exception is raised if ray.init() has not been
|
||||
called yet.
|
||||
"""
|
||||
if self.redis_client is None:
|
||||
raise RuntimeError("The ray global state API cannot be used "
|
||||
"before ray.init has been called.")
|
||||
|
||||
if self.redis_clients is None:
|
||||
raise RuntimeError("The ray global state API cannot be used "
|
||||
"before ray.init has been called.")
|
||||
|
||||
if self.global_state_accessor is None:
|
||||
raise RuntimeError("The ray global state API cannot be used "
|
||||
"before ray.init has been called.")
|
||||
if (self.redis_client is None or self.redis_clients is None
|
||||
or self.global_state_accessor is None):
|
||||
raise ray.exceptions.RayConnectionError(
|
||||
"Ray has not been started yet. You can start Ray with "
|
||||
"'ray.init()'.")
|
||||
|
||||
def disconnect(self):
|
||||
"""Disconnect global state from GCS."""
|
||||
|
||||
Reference in New Issue
Block a user