本文整理汇总了Python中distributed.worker.Worker.data['a']方法的典型用法代码示例。如果您正苦于以下问题:Python Worker.data['a']方法的具体用法?Python Worker.data['a']怎么用?Python Worker.data['a']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distributed.worker.Worker
的用法示例。
在下文中一共展示了Worker.data['a']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: f
# 需要导入模块: from distributed.worker import Worker [as 别名]
# 或者: from distributed.worker.Worker import data['a'] [as 别名]
def f():
s = Scheduler()
s.listen(0)
x = Worker(s.ip, s.port, ip='127.0.0.1')
y = Worker(s.ip, s.port, ip='127.0.0.1')
z = Worker(s.ip, s.port, ip='127.0.0.1')
x.data['a'] = 1
y.data['a'] = 2
yield [x._start(), y._start(), z._start()]
zz = rpc(ip=z.ip, port=z.port)
yield zz.compute(function=dumps(inc),
args=dumps(('a',)),
who_has={'a': [x.address]},
key='b')
assert z.data['b'] == 2
if 'a' in z.data:
del z.data['a']
yield zz.compute(function=dumps(inc),
args=dumps(('a',)),
who_has={'a': [y.address]},
key='c')
assert z.data['c'] == 3
yield [x._close(), y._close(), z._close()]
zz.close_streams()
示例2: f
# 需要导入模块: from distributed.worker import Worker [as 别名]
# 或者: from distributed.worker.Worker import data['a'] [as 别名]
def f():
c = Center(ip='127.0.0.1')
c.listen(0)
x = Worker(c.ip, c.port, ip='127.0.0.1')
y = Worker(c.ip, c.port, ip='127.0.0.1')
z = Worker(c.ip, c.port, ip='127.0.0.1')
x.data['a'] = 1
y.data['a'] = 2
yield [x._start(), y._start(), z._start()]
zz = rpc(ip=z.ip, port=z.port)
yield zz.compute(function=inc, args=('a',),
who_has={'a': {x.address}}, key='b')
assert z.data['b'] == 2
yield zz.compute(function=inc, args=('a',),
who_has={'a': {y.address}}, key='c')
assert z.data['c'] == 3
yield [x._close(), y._close(), z._close()]
zz.close_streams()