本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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()