mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
Remove experimental.NoReturn (#7475)
This commit is contained in:
parent
27b4ffa98e
commit
b4e2d5317e
3 changed files with 3 additions and 26 deletions
|
@ -91,7 +91,6 @@ from ray.exceptions import (
|
|||
ObjectStoreFullError,
|
||||
RayTimeoutError,
|
||||
)
|
||||
from ray.experimental.no_return import NoReturn
|
||||
from ray.utils import decode
|
||||
|
||||
cimport cpython
|
||||
|
@ -998,7 +997,6 @@ cdef class CoreWorker:
|
|||
c_owner_id,
|
||||
c_owner_address)
|
||||
|
||||
# TODO: handle noreturn better
|
||||
cdef store_task_outputs(
|
||||
self, worker, outputs, const c_vector[CObjectID] return_ids,
|
||||
c_vector[shared_ptr[CRayObject]] *returns):
|
||||
|
@ -1016,10 +1014,6 @@ cdef class CoreWorker:
|
|||
if isinstance(output, ray.actor.ActorHandle):
|
||||
raise Exception("Returning an actor handle from a remote "
|
||||
"function is not allowed).")
|
||||
elif output is NoReturn:
|
||||
serialized_objects.append(output)
|
||||
data_sizes.push_back(0)
|
||||
metadatas.push_back(string_to_buffer(b''))
|
||||
else:
|
||||
context = worker.get_serialization_context()
|
||||
serialized_object = context.serialize(output)
|
||||
|
@ -1036,11 +1030,7 @@ cdef class CoreWorker:
|
|||
|
||||
for i, serialized_object in enumerate(serialized_objects):
|
||||
# A nullptr is returned if the object already exists.
|
||||
if returns[0][i].get() == NULL:
|
||||
continue
|
||||
if serialized_object is NoReturn:
|
||||
returns[0][i].reset()
|
||||
else:
|
||||
if returns[0][i].get() != NULL:
|
||||
write_serialized_object(
|
||||
serialized_object, returns[0][i].get().GetData())
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
class NoReturn:
|
||||
"""Do not store the return value in the object store.
|
||||
|
||||
If a task returns this object, then Ray will not store this object in the
|
||||
object store. Calling `ray.get` on the task's return ObjectIDs may block
|
||||
indefinitely unless the task manually stores an object for the
|
||||
corresponding ObjectID.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
raise TypeError("The `NoReturn` object should not be instantiated")
|
|
@ -966,10 +966,8 @@ Status CoreWorker::AllocateReturnObjects(
|
|||
object_already_exists = !data_buffer;
|
||||
}
|
||||
}
|
||||
// Leave the return object as a nullptr if there is no data or metadata.
|
||||
// This allows the caller to prevent the core worker from storing an output
|
||||
// (e.g., to support ray.experimental.no_return.NoReturn).
|
||||
if (!object_already_exists && (data_buffer || metadatas[i])) {
|
||||
// Leave the return object as a nullptr if the object already exists.
|
||||
if (!object_already_exists) {
|
||||
return_objects->at(i) =
|
||||
std::make_shared<RayObject>(data_buffer, metadatas[i], contained_object_ids[i]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue