本文整理汇总了Python中ryu.lib.hub.joinall函数的典型用法代码示例。如果您正苦于以下问题:Python joinall函数的具体用法?Python joinall怎么用?Python joinall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了joinall函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:Annjana,项目名称:ryu,代码行数:28,代码来源:ofa_neutron_agent.py
示例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)
开发者ID:xianhuawei,项目名称:utils,代码行数:7,代码来源:l2switczh.py
示例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
开发者ID:gizmoguy,项目名称:faucet,代码行数:7,代码来源:gauge_pollers.py
示例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()
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:33,代码来源:manager.py
示例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()
开发者ID:MichalPalatinus,项目名称:ryu,代码行数:32,代码来源:manager.py
示例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()
开发者ID:Qazzzz,项目名称:ryu,代码行数:29,代码来源:manager.py
示例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 ---')
开发者ID:paisa4ever,项目名称:ryu,代码行数:7,代码来源:tester.py
示例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')
开发者ID:AkiraSuu,项目名称:ryu,代码行数:7,代码来源:sample_router.py
示例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])
开发者ID:cannium,项目名称:openflow_routing_framework,代码行数:8,代码来源:bgp_server.py
示例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()
开发者ID:Aries-Sushi,项目名称:ryu,代码行数:8,代码来源:client.py
示例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)
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:10,代码来源:test_hub.py
示例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])
开发者ID:bigclouds,项目名称:ryu,代码行数:11,代码来源:oxp_super.py
示例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])
开发者ID:beba-eu,项目名称:beba-ctrl,代码行数:12,代码来源:controller.py
示例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()
开发者ID:Ryu-Dragon-Knight,项目名称:Dragon-Knight,代码行数:50,代码来源:daemon.py
示例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))
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:14,代码来源:zserver.py
示例16: test_spawn_kill_die_joinall
def test_spawn_kill_die_joinall(self):
def _child(result):
result.append(1)
threads = []
result = []
with hub.Timeout(2):
threads.append(hub.spawn(_child, result))
threads.append(hub.spawn(_child, result))
hub.sleep(0.5)
for t in threads:
hub.kill(t)
hub.joinall(threads)
assert len(result) == 2
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:14,代码来源:test_hub.py
示例17: main
def main(args=None, prog=None):
try:
CONF(args=args, prog=prog,
project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(args=args, prog=prog,
project='ryu', version='ryu-manager %s' % version)
log.init_log()
if 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
# keep old behaivor, run ofp if no application is specified.
if not app_lists:
app_lists = ['ryu.controller.ofp_handler']
#if CONF.oxp_role == 'super':
# app_lists.extend(['ryu.openexchange.super.oxp_server_handler',
# 'ryu.openexchange.super.topology',
# 'ryu.openexchange.super.routing'])
#elif CONF.oxp_role == 'domain':
# app_lists.extend(
# ['ryu.openexchange.domain.oxp_client_handler',
# 'ryu.openexchange.network.abstract',
# 'ryu.openexchange.network.topo_reply',
# 'ryu.openexchange.network.echo_loop',
# 'ryu.openexchange.domain.translation'])
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()
开发者ID:Jasonlyt,项目名称:ryu,代码行数:49,代码来源:manager.py
示例18: serve
def serve(self):
# TODO: entry point
send_thr = hub.spawn(self._send_loop)
# send hello message immediately
#hello = self.ofproto_parser.OFPHello(self)
#self.send_msg(hello)
buf = "Server"
self.socket.sendall(buf)
try:
self._recv_loop()
finally:
hub.kill(send_thr)
hub.joinall([send_thr])
开发者ID:hu1uwa,项目名称:ryu,代码行数:15,代码来源:oxp_super.py
示例19: test_spawn_kill_nowait_joinall
def test_spawn_kill_nowait_joinall(self):
# XXX this test relies on the scheduling behaviour.
# the intention here is, killing threads before they get active.
def _child(result):
result.append(1)
threads = []
result = []
with hub.Timeout(2):
threads.append(hub.spawn(_child, result))
for t in threads:
hub.kill(t)
hub.joinall(threads)
assert len(result) == 0
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:15,代码来源:test_hub.py
示例20: test_spawn_kill_joinall
def test_spawn_kill_joinall(self):
def _child(ev2, result):
ev2.wait()
result.append(1)
ev2 = hub.Event()
threads = []
result = []
with hub.Timeout(2):
threads.append(hub.spawn(_child, ev2, result))
threads.append(hub.spawn(_child, ev2, result))
hub.sleep(0.5)
for t in threads:
hub.kill(t)
hub.joinall(threads)
assert len(result) == 0
开发者ID:5g-empower,项目名称:empower-ryu,代码行数:16,代码来源:test_hub.py
注:本文中的ryu.lib.hub.joinall函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论