本文整理匯總了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()