mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -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,
|
ObjectStoreFullError,
|
||||||
RayTimeoutError,
|
RayTimeoutError,
|
||||||
)
|
)
|
||||||
from ray.experimental.no_return import NoReturn
|
|
||||||
from ray.utils import decode
|
from ray.utils import decode
|
||||||
|
|
||||||
cimport cpython
|
cimport cpython
|
||||||
|
@ -998,7 +997,6 @@ cdef class CoreWorker:
|
||||||
c_owner_id,
|
c_owner_id,
|
||||||
c_owner_address)
|
c_owner_address)
|
||||||
|
|
||||||
# TODO: handle noreturn better
|
|
||||||
cdef store_task_outputs(
|
cdef store_task_outputs(
|
||||||
self, worker, outputs, const c_vector[CObjectID] return_ids,
|
self, worker, outputs, const c_vector[CObjectID] return_ids,
|
||||||
c_vector[shared_ptr[CRayObject]] *returns):
|
c_vector[shared_ptr[CRayObject]] *returns):
|
||||||
|
@ -1016,10 +1014,6 @@ cdef class CoreWorker:
|
||||||
if isinstance(output, ray.actor.ActorHandle):
|
if isinstance(output, ray.actor.ActorHandle):
|
||||||
raise Exception("Returning an actor handle from a remote "
|
raise Exception("Returning an actor handle from a remote "
|
||||||
"function is not allowed).")
|
"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:
|
else:
|
||||||
context = worker.get_serialization_context()
|
context = worker.get_serialization_context()
|
||||||
serialized_object = context.serialize(output)
|
serialized_object = context.serialize(output)
|
||||||
|
@ -1036,11 +1030,7 @@ cdef class CoreWorker:
|
||||||
|
|
||||||
for i, serialized_object in enumerate(serialized_objects):
|
for i, serialized_object in enumerate(serialized_objects):
|
||||||
# A nullptr is returned if the object already exists.
|
# A nullptr is returned if the object already exists.
|
||||||
if returns[0][i].get() == NULL:
|
if returns[0][i].get() != NULL:
|
||||||
continue
|
|
||||||
if serialized_object is NoReturn:
|
|
||||||
returns[0][i].reset()
|
|
||||||
else:
|
|
||||||
write_serialized_object(
|
write_serialized_object(
|
||||||
serialized_object, returns[0][i].get().GetData())
|
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;
|
object_already_exists = !data_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Leave the return object as a nullptr if there is no data or metadata.
|
// Leave the return object as a nullptr if the object already exists.
|
||||||
// This allows the caller to prevent the core worker from storing an output
|
if (!object_already_exists) {
|
||||||
// (e.g., to support ray.experimental.no_return.NoReturn).
|
|
||||||
if (!object_already_exists && (data_buffer || metadatas[i])) {
|
|
||||||
return_objects->at(i) =
|
return_objects->at(i) =
|
||||||
std::make_shared<RayObject>(data_buffer, metadatas[i], contained_object_ids[i]);
|
std::make_shared<RayObject>(data_buffer, metadatas[i], contained_object_ids[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue