[GCS Actor Management] Gcs actor management broken detached actor (#9473)

This commit is contained in:
SangBin Cho
2020-07-16 00:41:18 -07:00
committed by GitHub
parent 06ed2313e2
commit 2f674728a6
5 changed files with 33 additions and 24 deletions
+10 -7
View File
@@ -596,14 +596,12 @@ cdef void get_py_stack(c_string* stack_out) nogil:
This can be called from within C++ code to retrieve the file name and line
number of the Python code that is calling into the core worker.
"""
with gil:
try:
frame = inspect.currentframe()
except ValueError: # overhead of exception handling is about 20us
stack_out[0] = "".encode("ascii")
return
msg = ""
while frame:
filename = frame.f_code.co_filename
@@ -632,7 +630,6 @@ cdef void get_py_stack(c_string* stack_out) nogil:
frame = frame.f_back
stack_out[0] = msg.encode("ascii")
cdef shared_ptr[CBuffer] string_to_buffer(c_string& c_str):
cdef shared_ptr[CBuffer] empty_metadata
if c_str.size() == 0:
@@ -1080,12 +1077,18 @@ cdef class CoreWorker:
def get_named_actor_handle(self, const c_string &name):
cdef:
pair[const CActorHandle*, CRayStatus] named_actor_handle_pair
# NOTE: This handle should not be stored anywhere.
const CActorHandle* c_actor_handle = (
CCoreWorkerProcess.GetCoreWorker().GetNamedActorHandle(name))
const CActorHandle* c_actor_handle
# We need it because GetNamedActorHandle needs
# to call a method that holds the gil.
with nogil:
named_actor_handle_pair = (
CCoreWorkerProcess.GetCoreWorker().GetNamedActorHandle(name))
c_actor_handle = named_actor_handle_pair.first
check_status(named_actor_handle_pair.second)
if c_actor_handle == NULL:
raise ValueError("Named Actor Handle Not Found")
return self.make_actor_handle(c_actor_handle)
def serialize_actor_handle(self, ActorID actor_id):
+2 -1
View File
@@ -124,7 +124,8 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
*bytes,
CObjectID *c_actor_handle_id)
const CActorHandle* GetActorHandle(const CActorID &actor_id) const
const CActorHandle* GetNamedActorHandle(const c_string &name)
pair[const CActorHandle*, CRayStatus] GetNamedActorHandle(
const c_string &name)
void AddLocalReference(const CObjectID &object_id)
void RemoveLocalReference(const CObjectID &object_id)
void PutObjectIntoPlasma(const CRayObject &object,