Here is the sample code to get OwnerDiedError
:
import ray
import time
@ray.remote
class W:
def p(self):
# or a dataset
# r_ds = ds.map_batches(...)
r_ds = [ray.put([1])]
return r_ds
def start():
w = W.remote()
return ray.get(w.p.remote())
r_ds = start()
time.sleep(2)
ray.get(r_ds)
# or a dataset
# r_ds.write_csv(...)
This is really weird from a user’s perspective, why are we allowing this? How to fix this?
Maybe the object_ref owned by a actor could keep a ref to the actor handle so users do not need to worry about this? For example:
# This make sure actor handle ref count won't be zero
object_ref._owner_actor = actor_handle
Also, this applies to the ray dataset, if you create a dataset in the actor, dataset.save will fail too, how to fix this for dataset?