本文整理汇总了Python中cattle.Config.eventlet_backdoor方法的典型用法代码示例。如果您正苦于以下问题:Python Config.eventlet_backdoor方法的具体用法?Python Config.eventlet_backdoor怎么用?Python Config.eventlet_backdoor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cattle.Config
的用法示例。
在下文中一共展示了Config.eventlet_backdoor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import eventlet_backdoor [as 别名]
from eventlet.queue import Queue, Empty, Full
from eventlet import tpool
pool = eventlet.GreenPool(size=Config.workers() * 2)
class Worker:
def __init__(self, target=None, args=None):
self._target = target
self._args = args
def start(self):
pool.spawn_n(self._target, *self._args)
log.info("Using eventlet")
port = Config.eventlet_backdoor()
if port:
from eventlet import backdoor
log.info("Launching eventlet backdoor on port %s", port)
eventlet.spawn(backdoor.backdoor_server, eventlet.listen(("localhost", port)))
elif Config.is_multi_proc():
from Queue import Empty, Full
from multiprocessing import Queue, Process
Worker = Process
log.info("Using multiprocessing")
elif Config.is_multi_thread():
from Queue import Queue, Empty, Full