Open Atry opened 5 months ago
There is a question on StackOverflow about this issue: https://stackoverflow.com/questions/78421032/how-to-properly-clean-up-non-serializable-states-associated-with-a-ray-object
@Atry We currently don't have it. I think you can do the application layer reference counting for your use case.
I think it is not possible to reliably do the application layer reference counting.
Yes but if your application is simple, you can do application layer reference counting as a workaround for now to unblock you.
Description
A Ray API to register a callback triggered when a Ray object is evicted.
Use case
Suppose I have a Ray actor that can create a Ray object that associates with some non-serializable states. In the following example, the non-serializable state is a temporary directory.
I want the following
on_evicted
function to be triggered on the creator actor's worker process whenref
is evicted, i.e., when the Ray distributed reference counting for the Ray object is zero.How can I modify
MyCreatorActor.create
to registeron_evicted
?Is there a Ray API similar to
weakref.ref(obj, callback)
to register such a callback?