本文整理汇总了Python中cattle.Config.is_multi_thread方法的典型用法代码示例。如果您正苦于以下问题:Python Config.is_multi_thread方法的具体用法?Python Config.is_multi_thread怎么用?Python Config.is_multi_thread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cattle.Config
的用法示例。
在下文中一共展示了Config.is_multi_thread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Exception
# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import is_multi_thread [as 别名]
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
from threading import Thread
Worker = Thread
log.info("Using threading")
else:
raise Exception("Could not determine concurrency style set " "CATTLE_AGENT_MULTI to eventlet, thread, or " "proc")
def spawn(**kw):
p = Worker(**kw)
p.daemon = True
p.start()
return p