If I create an actor in the driver process, and try to reference it in a new process from multiprocessing, ray hangs. Is there a workaround that works with multiprocessing?
import ray
import torch.multiprocessing as mp
@ray.remote
class TestActor:
def __init__(self):
pass
def dummy(self):
return "asdf"
def mp_fn():
print(1)
actor = ray.get_actor("dummy")
print(2)
print(ray.get(actor.dummy.remote()))
print(3)
if __name__ == "__main__":
ray.init()
actor = TestActor.options(name="dummy").remote()
p = mp.Process(
target=mp_fn,
args=(),
)
p.start()