我有一个在以下计算机上运行的光线群集:
ray start --head --redis-port=6379
我有两个需要在群集上运行的文件。生产者p_ray.py:
import ray ray.init(address='auto', redis_password='5241590000000000') @ray.remote class Counter(object): def __init__(self): self.n = 0 def increment(self): self.n += 1 def read(self): return self.n counters = [Counter.remote() for i in range(4)] [c.increment.remote() for c in counters] futures = [c.read.remote() for c in counters] print(futures, type(futures[0])) obj_id = ray.put(ray.get(futures)) print(obj_id) print(ray.get(obj_id)) while True: pass
消费者c_ray.py:
import ray ray.init(address='auto', redis_password='5241590000000000') [objs] = ray.objects() print('OBJ-ID:', objs, 'TYPE:', type(objs)) print(ray.get([objs]))
我的意图是从生产者那里存储期货对象,并在消费者中检索它。我可以在使用者中检索对象ID。但是,进入消费者永远不会返回。
我在做什么错?
我该如何解决我的要求?
我有一个在以下计算机上运行的ray群集:ray start --head --redis-port = 6379我有两个需要在群集上运行的文件。生产者p_ray.py:导入ray ray.init(address ='auto',...
此特殊情况可能是一个错误(我不确定100%正确)。我在Ray Github上创建了一个问题。