You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes an actor can depend on external resources that need be cleaned up upon actor termination. and users would want to do the clean up in Actor.__del__.
But currently the actor object is referenced by global_worker.actors, thus Actor.__del__ won't be called.
We should add a callback in CoreWorker::HandleKillActor to remove the reference.
Repro:
importtimeimportray@ray.remoteclassActor:
def__init__(self):
print("Actor.__init__")
defping(self):
# Without the following, `__del__` won't be called.worker=ray._private.worker.global_workeractor_id=worker.actor_iddelworker.actors[actor_id]
return""def__del__(self):
print("Actor.__del__")
actor=Actor.remote()
ray.get(actor.ping.remote())
delactortime.sleep(3)
Sometimes an actor can depend on external resources that need be cleaned up upon actor termination. and users would want to do the clean up in
Actor.__del__
.But currently the actor object is referenced by
global_worker.actors
, thusActor.__del__
won't be called.We should add a callback in
CoreWorker::HandleKillActor
to remove the reference.Repro:
Related issue for Ray Data: #49929
The text was updated successfully, but these errors were encountered: