Hi, I defined an Actor class:
@ray.remote
class A:
def __init__(self):
self.a = 1
def run(self):
while True:
# do something with self.a
Then I created many actors,
actors = [A() for _ in range(10)]
ws = [a.run.remote() for a in actors] # run the background
In the main process, I want to broadcast the values of a
to these actors. I think I can define a function called set_a
in the class of A
, but I think that is not very efficient. I can also use a queue for each actor to send data to all actors. However, I think that is trivial because I should create many queues. Is there any elegant way to achieve this?