在ray.io中存储和检索对象>>

问题描述 投票:0回答:1

我有一个在以下计算机上运行的光线群集:

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',...

actor consumer ray publisher
1个回答
0
投票

此特殊情况可能是一个错误(我不确定100%正确)。我在Ray Github上创建了一个问题。

© www.soinside.com 2019 - 2024. All rights reserved.