mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 14:48:54 +08:00
[api] Second round of 1.0 API changes: exceptions, num_return_vals (#10377)
This commit is contained in:
+15
-35
@@ -41,12 +41,7 @@ class CrossLanguageError(RayError):
|
||||
ray_exception.formatted_exception_string))
|
||||
|
||||
|
||||
class RayConnectionError(RayError):
|
||||
"""Raised when ray is not yet connected but needs to be."""
|
||||
pass
|
||||
|
||||
|
||||
class RayCancellationError(RayError):
|
||||
class TaskCancelledError(RayError):
|
||||
"""Raised when this task is cancelled.
|
||||
|
||||
Attributes:
|
||||
@@ -143,7 +138,7 @@ class RayTaskError(RayError):
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
class RayWorkerError(RayError):
|
||||
class WorkerCrashedError(RayError):
|
||||
"""Indicates that the worker died unexpectedly while executing a task."""
|
||||
|
||||
def __str__(self):
|
||||
@@ -161,8 +156,8 @@ class RayActorError(RayError):
|
||||
return "The actor died unexpectedly before finishing this task."
|
||||
|
||||
|
||||
class RayletError(RayError):
|
||||
"""Indicates that the Raylet client has errored.
|
||||
class RaySystemError(RayError):
|
||||
"""Indicates that Ray encountered a system error.
|
||||
|
||||
This exception can be thrown when the raylet is killed.
|
||||
"""
|
||||
@@ -171,7 +166,7 @@ class RayletError(RayError):
|
||||
self.client_exc = client_exc
|
||||
|
||||
def __str__(self):
|
||||
return f"The Raylet died with this message: {self.client_exc}"
|
||||
return f"System error: {self.client_exc}"
|
||||
|
||||
|
||||
class ObjectStoreFullError(RayError):
|
||||
@@ -184,21 +179,13 @@ class ObjectStoreFullError(RayError):
|
||||
def __str__(self):
|
||||
return super(ObjectStoreFullError, self).__str__() + (
|
||||
"\n"
|
||||
"The local object store is full of objects that are still in scope"
|
||||
" and cannot be evicted. Try increasing the object store memory "
|
||||
"available with ray.init(object_store_memory=<bytes>). "
|
||||
"You can also try setting an option to fallback to LRU eviction "
|
||||
"when the object store is full by calling "
|
||||
"ray.init(lru_evict=True). See also: "
|
||||
"https://docs.ray.io/en/latest/memory-management.html.")
|
||||
"The local object store is full of objects that are still in "
|
||||
"scope and cannot be evicted. Tip: Use the `ray memory` command "
|
||||
"to list active objects in the cluster.")
|
||||
|
||||
|
||||
class UnreconstructableError(RayError):
|
||||
"""Indicates that an object is lost and cannot be reconstructed.
|
||||
|
||||
Note, this exception only happens for actor objects. If actor's current
|
||||
state is after object's creating task, the actor cannot re-run the task to
|
||||
reconstruct the object.
|
||||
class ObjectLostError(RayError):
|
||||
"""Indicates that an object has been lost due to node failure.
|
||||
|
||||
Attributes:
|
||||
object_ref: ID of the object.
|
||||
@@ -208,17 +195,10 @@ class UnreconstructableError(RayError):
|
||||
self.object_ref = object_ref
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
f"Object {self.object_ref.hex()} is lost "
|
||||
"(either LRU evicted or deleted by user) and "
|
||||
"cannot be reconstructed. Try increasing the object store "
|
||||
"memory available with ray.init(object_store_memory=<bytes>) "
|
||||
"or setting object store limits with "
|
||||
"ray.remote(object_store_memory=<bytes>). "
|
||||
"See also: https://docs.ray.io/en/latest/memory-management.html")
|
||||
return (f"Object {self.object_ref.hex()} is lost due to node failure.")
|
||||
|
||||
|
||||
class RayTimeoutError(RayError):
|
||||
class GetTimeoutError(RayError):
|
||||
"""Indicates that a call to the worker timed out."""
|
||||
pass
|
||||
|
||||
@@ -232,9 +212,9 @@ RAY_EXCEPTION_TYPES = [
|
||||
PlasmaObjectNotAvailable,
|
||||
RayError,
|
||||
RayTaskError,
|
||||
RayWorkerError,
|
||||
WorkerCrashedError,
|
||||
RayActorError,
|
||||
ObjectStoreFullError,
|
||||
UnreconstructableError,
|
||||
RayTimeoutError,
|
||||
ObjectLostError,
|
||||
GetTimeoutError,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user