Remove experimental.NoReturn (#7475)

This commit is contained in:
Edward Oakes 2020-03-09 11:09:36 -07:00 committed by GitHub
parent 27b4ffa98e
commit b4e2d5317e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 26 deletions

View file

@ -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())

View file

@ -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")

View file

@ -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]);
}