本文整理汇总了Python中ryu.lib.hub.joinall函数的典型用法代码示例。如果您正苦于以下问题:Python joinall函数的具体用法?Python joinall怎么用?Python joinall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了joinall函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
try:
CONF(project='ryu', version='ofa_neutron_agent %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ofa_neutron_agent %s' % version)
osn_config.setup_logging(CONF)
app_lists = CONF.app_lists + CONF.app
if not app_lists:
app_lists = ['neutron.plugins.ofagent.agent.ofa_neutron_agent']
app_mgr = AppManager.get_instance()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
services = []
services.extend(app_mgr.instantiate_apps(**contexts))
webapp = wsgi.start_service(app_mgr)
if webapp:
thr = hub.spawn(webapp)
services.append(thr)
try:
hub.joinall(services)
finally:
app_mgr.close()
示例2: close
def close(self):
self.is_active = False
if self.link_discovery:
self.lldp_event.set()
self.link_event.set()
self.msg_event.set()
hub.joinall(self.threads)
示例3: stop
def stop(self):
super(GaugeThreadPoller, self).stop()
self._running = False
if self.is_active():
hub.kill(self.thread)
hub.joinall([self.thread])
self.thread = None
示例4: main
def main():
try:
CONF(project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ryu-manager %s' % version)
log.init_log()
app_lists = CONF.app_lists + CONF.app
app_mgr = AppManager()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
app_mgr.instantiate_apps(**contexts)
services = []
# TODO: do the following in app_manager's instantiate_apps()
ofpapp = controller.start_service(app_mgr)
if ofpapp:
thr = hub.spawn(ofpapp)
services.append(thr)
webapp = wsgi.start_service(app_mgr)
if webapp:
thr = hub.spawn(webapp)
services.append(thr)
try:
hub.joinall(services)
finally:
app_mgr.close()
示例5: main
def main():
try:
CONF(project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ryu-manager %s' % version)
log.init_log()
# always enable ofp for now.
app_lists = CONF.app_lists + CONF.app + ['ryu.controller.ofp_handler']
app_mgr = AppManager()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
app_mgr.instantiate_apps(**contexts)
services = []
ctlr = controller.OpenFlowController()
thr = hub.spawn(ctlr)
services.append(thr)
webapp = wsgi.start_service(app_mgr)
if webapp:
thr = hub.spawn(webapp)
services.append(thr)
try:
hub.joinall(services)
finally:
app_mgr.close()
示例6: main
def main():
try:
CONF(project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ryu-manager %s' % version)
log.init_log()
app_lists = CONF.app_lists + CONF.app
# keep old behaivor, run ofp if no application is specified.
if not app_lists:
app_lists = ['ryu.controller.ofp_handler']
app_mgr = AppManager.get_instance()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
services = []
services.extend(app_mgr.instantiate_apps(**contexts))
webapp = wsgi.start_service(app_mgr)
if webapp:
thr = hub.spawn(webapp)
services.append(thr)
try:
hub.joinall(services)
finally:
app_mgr.close()
示例7: close
def close(self):
if self.test_thread is not None:
hub.kill(self.test_thread)
if self.ingress_event:
self.ingress_event.set()
hub.joinall([self.test_thread])
self._test_end('--- Test terminated ---')
示例8: _disable_router
def _disable_router(self):
if self._arp_thread is not None:
self._arp_thread.kill()
hub.joinall([self._arp_thread])
self._arp_thread = None
# TODO: implement real routing logic
self.logger.debug('TODO:_disable_router')
示例9: serve
def serve(self):
send_thr = hub.spawn(self._send_loop)
try:
self._recv_loop()
finally:
hub.kill(send_thr)
hub.joinall([send_thr])
示例10: stop
def stop(self):
# NOTE(jkoelker) Stop the idl and event_proxy threads first
# letting them finish their current loop.
self.is_active = False
hub.joinall(self.threads)
self._idl.close()
super(RemoteOvsdb, self).stop()
示例11: test_spawn_exception_joinall
def test_spawn_exception_joinall(self):
def _child():
raise Exception("hoge")
threads = []
with hub.Timeout(2):
threads.append(hub.spawn(_child))
threads.append(hub.spawn(_child))
hub.sleep(0.5)
hub.joinall(threads)
示例12: serve
def serve(self):
send_thr = hub.spawn(self._send_loop)
hello = self.oxproto_parser.OXPHello(self)
self.send_msg(hello)
try:
self._recv_loop()
finally:
hub.kill(send_thr)
hub.joinall([send_thr])
示例13: serve
def serve(self):
send_thr = hub.spawn(self._send_loop)
# send hello message immediately
hello = self.ofproto_parser.OFPHello(self)
self.send_msg(hello)
try:
self._recv_loop()
finally:
hub.kill(send_thr)
hub.joinall([send_thr])
示例14: main
def main(args=None, prog=None):
try:
CONF(
args=args,
prog=prog,
project="ryu",
version="ryu-manager {}".format(version),
default_config_files=["/usr/local/etc/ryu/ryu.conf"],
)
except cfg.ConfigFilesNotFoundError:
CONF(args=args, prog=prog, project="ryu", version="ryu-manager {}".format(version))
log.init_log()
hub.patch(thread=True)
if CONF.pid_file:
LOG.info("Pid file : %s", CONF.pid_file)
import os
with open(CONF.pid_file, "w") as pid_file:
pid_file.write(str(os.getpid()))
app_lists = CONF.app_lists + CONF.app
if not app_lists:
app_lists = ["ryu.controller.ofp_handler", "dragon_knight.dk_plugin"]
if "ryu.controller.ofp_handler" not in app_lists:
app_lists.append("ryu.controller.ofp_handler")
if "dragon_knight.dk_plugin" not in app_lists:
app_lists.append("dragon_knight.dk_plugin")
app_mgr = AppManager.get_instance()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
services = []
services.extend(app_mgr.instantiate_apps(**contexts))
webapp = wsgi.start_service(app_mgr)
if webapp:
thr = hub.spawn(webapp)
services.append(thr)
try:
hub.joinall(services)
finally:
app_mgr.close()
示例15: start
def start(self):
self.is_active = True
self.sock.settimeout(GLOBAL_CONF.socket_timeout)
self._threads.append(hub.spawn(self._send_loop))
self._threads.append(hub.spawn(self._recv_loop))
self.server.send_event_to_observers(
zserver_event.EventZClientConnected(self))
hub.joinall(self._threads)
self.server.send_event_to_observers(
zserver_event.EventZClientDisconnected(self))