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


Python Executor.shutdown方法代码示例

本文整理汇总了Python中distributed.Executor.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Python Executor.shutdown方法的具体用法?Python Executor.shutdown怎么用?Python Executor.shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distributed.Executor的用法示例。


在下文中一共展示了Executor.shutdown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bokeh_non_standard_ports

# 需要导入模块: from distributed import Executor [as 别名]
# 或者: from distributed.Executor import shutdown [as 别名]
def test_bokeh_non_standard_ports():
    pytest.importorskip('bokeh')

    try:
        proc = Popen(['dscheduler',
                      '--port', '3448',
                      '--http-port', '4824',
                      '--bokeh-port', '4832'], stdout=PIPE, stderr=PIPE)
        e = Executor('127.0.0.1:3448')

        while True:
            line = proc.stderr.readline()
            if b'Bokeh UI' in line:
                break

        start = time()
        while True:
            try:
                response = requests.get('http://localhost:4832/status/')
                assert response.ok
                break
            except:
                sleep(0.1)
                assert time() < start + 5

    finally:
        with ignoring(Exception):
            e.shutdown()
        with ignoring(Exception):
            os.kill(proc.pid, signal.SIGINT)
开发者ID:LiuXiaozeeee,项目名称:distributed,代码行数:32,代码来源:test_dscheduler.py

示例2: test_bokeh

# 需要导入模块: from distributed import Executor [as 别名]
# 或者: from distributed.Executor import shutdown [as 别名]
def test_bokeh():
    pytest.importorskip('bokeh')

    try:
        proc = Popen(['dscheduler'], stdout=PIPE, stderr=PIPE)
        e = Executor('127.0.0.1:%d' % Scheduler.default_port)

        while True:
            line = proc.stderr.readline()
            if b'Bokeh UI' in line:
                break

        start = time()
        while True:
            try:
                for name in [socket.gethostname(), 'localhost', '127.0.0.1', get_ip()]:
                    response = requests.get('http://%s:8787/status/' % name)
                    assert response.ok
                break
            except:
                sleep(0.1)
                assert time() < start + 5

    finally:
        with ignoring(Exception):
            e.shutdown()
        with ignoring(Exception):
            os.kill(proc.pid, signal.SIGINT)
开发者ID:LiuXiaozeeee,项目名称:distributed,代码行数:30,代码来源:test_dscheduler.py

示例3: test_hostport

# 需要导入模块: from distributed import Executor [as 别名]
# 或者: from distributed.Executor import shutdown [as 别名]
def test_hostport():
    try:
        proc = Popen(['dask-scheduler', '--no-bokeh',
                      '--host', '127.0.0.1:8978'],
                     stdout=PIPE, stderr=PIPE)
        e = Executor('127.0.0.1:8978')
    finally:
        e.shutdown()
        os.kill(proc.pid, signal.SIGINT)
开发者ID:yonglehou,项目名称:distributed,代码行数:11,代码来源:test_dscheduler.py

示例4: test_defaults

# 需要导入模块: from distributed import Executor [as 别名]
# 或者: from distributed.Executor import shutdown [as 别名]
def test_defaults():
    try:
        proc = Popen(['dscheduler', '--no-bokeh'], stdout=PIPE, stderr=PIPE)
        e = Executor('127.0.0.1:%d' % Scheduler.default_port)

        response = requests.get('http://127.0.0.1:9786/info.json')
        assert response.ok
        assert response.json()['status'] == 'running'
    finally:
        e.shutdown()
        os.kill(proc.pid, signal.SIGINT)
开发者ID:LiuXiaozeeee,项目名称:distributed,代码行数:13,代码来源:test_dscheduler.py

示例5: test_no_bokeh

# 需要导入模块: from distributed import Executor [as 别名]
# 或者: from distributed.Executor import shutdown [as 别名]
def test_no_bokeh():
    pytest.importorskip('bokeh')

    try:
        proc = Popen(['dscheduler', '--no-bokeh'], stdout=PIPE, stderr=PIPE)
        e = Executor('127.0.0.1:%d' % Scheduler.default_port)
        for i in range(3):
            assert b'bokeh' not in next(proc.stderr)
    finally:
        with ignoring(Exception):
            e.shutdown()
        with ignoring(Exception):
            os.kill(proc.pid, signal.SIGINT)
开发者ID:coobas,项目名称:distributed,代码行数:15,代码来源:test_dscheduler.py

示例6: test_Executor_solo

# 需要导入模块: from distributed import Executor [as 别名]
# 或者: from distributed.Executor import shutdown [as 别名]
def test_Executor_solo(loop):
    e = Executor(loop=loop)
    e.shutdown()
开发者ID:HugoTian,项目名称:distributed,代码行数:5,代码来源:test_local.py


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