本文整理汇总了Python中distributed.Scheduler.close方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.close方法的具体用法?Python Scheduler.close怎么用?Python Scheduler.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distributed.Scheduler
的用法示例。
在下文中一共展示了Scheduler.close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: f
# 需要导入模块: from distributed import Scheduler [as 别名]
# 或者: from distributed.Scheduler import close [as 别名]
def f(c, a, b):
s = Scheduler((c.ip, c.port), loop=loop)
yield s.sync_center()
done = s.start(0)
progress = TextProgressBar([], scheduler=(s.ip, s.port), start=False,
interval=0.01)
yield progress.listen()
assert progress.status == 'finished'
check_bar_completed(capsys)
s.close()
yield done
示例2: g
# 需要导入模块: from distributed import Scheduler [as 别名]
# 或者: from distributed.Scheduler import close [as 别名]
def g():
s = Scheduler(ip='127.0.0.1')
done = s.start()
s.listen(0)
a = Worker('127.0.0.1', s.port, ncores=2, ip='127.0.0.1')
yield a._start()
b = Worker('127.0.0.1', s.port, ncores=1, ip=b_ip)
yield b._start()
start = time()
try:
while len(s.ncores) < 2:
yield gen.sleep(0.01)
if time() - start > 5:
raise Exception("Cluster creation timeout")
yield f(s, a, b)
finally:
logger.debug("Closing out test cluster")
for w in [a, b]:
with ignoring(TimeoutError, StreamClosedError, OSError):
yield w._close()
if os.path.exists(w.local_dir):
shutil.rmtree(w.local_dir)
yield s.close()
示例3: start_cluster
# 需要导入模块: from distributed import Scheduler [as 别名]
# 或者: from distributed.Scheduler import close [as 别名]
def start_cluster(ncores, scheduler_addr, loop, security=None,
Worker=Worker, scheduler_kwargs={}, worker_kwargs={}):
s = Scheduler(loop=loop, validate=True, security=security,
**scheduler_kwargs)
done = s.start(scheduler_addr)
workers = [Worker(s.address, ncores=ncore[1], name=i, security=security,
loop=loop, validate=True,
**(merge(worker_kwargs, ncore[2])
if len(ncore) > 2
else worker_kwargs))
for i, ncore in enumerate(ncores)]
for w in workers:
w.rpc = workers[0].rpc
yield [w._start(ncore[0]) for ncore, w in zip(ncores, workers)]
start = time()
while (len(s.workers) < len(ncores) or
any(comm.comm is None for comm in s.stream_comms.values())):
yield gen.sleep(0.01)
if time() - start > 5:
yield [w._close(timeout=1) for w in workers]
yield s.close(fast=True)
raise Exception("Cluster creation timeout")
raise gen.Return((s, workers))
示例4: f
# 需要导入模块: from distributed import Scheduler [as 别名]
# 或者: from distributed.Scheduler import close [as 别名]
def f():
s = Scheduler(loop=loop)
done = s.start(0)
a = Worker(s.ip, s.port, loop=loop, ncores=1)
b = Worker(s.ip, s.port, loop=loop, ncores=1)
yield [a._start(0), b._start(0)]
progress = TextProgressBar([], scheduler=(s.ip, s.port), start=False,
interval=0.01)
yield progress.listen()
assert progress.status == 'finished'
check_bar_completed(capsys)
yield [a._close(), b._close()]
s.close()
yield done
示例5: f
# 需要导入模块: from distributed import Scheduler [as 别名]
# 或者: from distributed.Scheduler import close [as 别名]
def f(c, a, b):
s = Scheduler((c.ip, c.port), loop=loop)
yield s.sync_center()
done = s.start()
s.update_graph(dsk={'x': (div, 1, 0)},
keys=['x'])
progress = TextProgressBar(['x'], scheduler=(s.ip, s.port),
start=False, interval=0.01)
yield progress.listen()
assert progress.status == 'error'
assert progress.stream.closed()
progress = TextProgressBar(['x'], scheduler=(s.ip, s.port),
start=False, interval=0.01)
yield progress.listen()
assert progress.status == 'error'
assert progress.stream.closed()
s.close()
yield done
示例6: test_tls_scheduler
# 需要导入模块: from distributed import Scheduler [as 别名]
# 或者: from distributed.Scheduler import close [as 别名]
def test_tls_scheduler(security, loop):
s = Scheduler(security=security, loop=loop)
s.start('localhost')
assert s.address.startswith('tls')
s.close()