当前位置: 首页>>代码示例>>Python>>正文


Python Scheduler.close方法代码示例

本文整理汇总了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
开发者ID:canavandl,项目名称:distributed,代码行数:16,代码来源:test_progressbar.py

示例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()
开发者ID:lucashtnguyen,项目名称:distributed,代码行数:27,代码来源:utils_test.py

示例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))
开发者ID:tomMoral,项目名称:distributed,代码行数:27,代码来源:utils_test.py

示例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
开发者ID:amosonn,项目名称:distributed,代码行数:19,代码来源:test_progressbar.py

示例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
开发者ID:kevineriklee,项目名称:distributed,代码行数:25,代码来源:test_progressbar.py

示例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()
开发者ID:tomMoral,项目名称:distributed,代码行数:7,代码来源:test_utils_test.py


注:本文中的distributed.Scheduler.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。