Changes:增加了自动生成修改数据变csv的格式
This commit is contained in:
18
ray_example.py
Normal file
18
ray_example.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import ray
|
||||
ray.init()
|
||||
|
||||
@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(ray.get(futures))
|
||||
Reference in New Issue
Block a user