diff --git a/python/ray/_raylet.pyx b/python/ray/_raylet.pyx index bb76a8018..ca719f517 100644 --- a/python/ray/_raylet.pyx +++ b/python/ray/_raylet.pyx @@ -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()) diff --git a/python/ray/experimental/no_return.py b/python/ray/experimental/no_return.py deleted file mode 100644 index deaed5e42..000000000 --- a/python/ray/experimental/no_return.py +++ /dev/null @@ -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") diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index 5ac754592..a95e1dbbc 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -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(data_buffer, metadatas[i], contained_object_ids[i]); }