Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore errors in ObjectID.__dealloc__ #5997

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Ignore errors in ObjectID.__dealloc__
  • Loading branch information
edoakes committed Oct 24, 2019
commit 621a9450575baba32d29123d16b077a03c202b3b
17 changes: 12 additions & 5 deletions python/ray/includes/unique_ids.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,27 @@ cdef class ObjectID(BaseID):
def __init__(self, id):
check_id(id)
self.data = CObjectID.FromBinary(<c_string>id)
self.in_core_worker = False

worker = ray.worker.global_worker
# TODO(edoakes): there are dummy object IDs being created in
# includes/task.pxi before the core worker is initialized.
if hasattr(worker, "core_worker"):
worker.core_worker.add_active_object_id(self)
self.in_core_worker = True
else:
self.in_core_worker = False

def __dealloc__(self):
worker = ray.worker.global_worker
if self.in_core_worker and hasattr(worker, "core_worker"):
worker.core_worker.remove_active_object_id(self)
if self.in_core_worker:
try:
worker = ray.worker.global_worker
worker.core_worker.remove_active_object_id(self)
except Exception as e:
# There is a strange error in rllib that causes the above to
# fail. Somehow the global 'ray' variable corresponding to the
# imported package is None when this gets called. Unfortunately
# this is hard to debug because . In any case, there's not much
# we can do besides ignore it (re-importing ray won't help).
pass

cdef CObjectID native(self):
return <CObjectID>self.data
Expand Down