本文整理汇总了Python中distributed.Worker.start方法的典型用法代码示例。如果您正苦于以下问题:Python Worker.start方法的具体用法?Python Worker.start怎么用?Python Worker.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distributed.Worker
的用法示例。
在下文中一共展示了Worker.start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_repl_worker
# 需要导入模块: from distributed import Worker [as 别名]
# 或者: from distributed.Worker import start [as 别名]
def get_repl_worker():
loop = IOLoop.current()
t = Thread(target=loop.start, daemon=True)
t.start()
w = Worker('tcp://127.0.0.1:8786', loop=loop)
w.start() # choose randomly assigned port
return w
示例2: run_worker
# 需要导入模块: from distributed import Worker [as 别名]
# 或者: from distributed.Worker import start [as 别名]
def run_worker(port, center_port, **kwargs):
from distributed import Worker
from tornado.ioloop import IOLoop
import logging
logging.getLogger("tornado").setLevel(logging.CRITICAL)
worker = Worker('127.0.0.1', port, '127.0.0.1', center_port, **kwargs)
worker.start()
IOLoop.current().start()
IOLoop.current().close() # Never reached. TODO: clean shutdown of IOLoop
示例3: run_worker
# 需要导入模块: from distributed import Worker [as 别名]
# 或者: from distributed.Worker import start [as 别名]
def run_worker(port, center_port, **kwargs):
from distributed import Worker
from tornado.ioloop import IOLoop, PeriodicCallback
import logging
IOLoop.clear_instance()
loop = IOLoop(); loop.make_current()
PeriodicCallback(lambda: None, 500).start()
logging.getLogger("tornado").setLevel(logging.CRITICAL)
worker = Worker('127.0.0.1', port, '127.0.0.1', center_port, **kwargs)
worker.start()
loop.start()