本文整理匯總了Python中oslo_messaging.set_transport_defaults方法的典型用法代碼示例。如果您正苦於以下問題:Python oslo_messaging.set_transport_defaults方法的具體用法?Python oslo_messaging.set_transport_defaults怎麽用?Python oslo_messaging.set_transport_defaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oslo_messaging
的用法示例。
在下文中一共展示了oslo_messaging.set_transport_defaults方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: set_defaults
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def set_defaults(control_exchange):
messaging.set_transport_defaults(control_exchange)
示例2: prepare_service
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def prepare_service(argv=None):
oslo_i18n.enable_lazy()
log.set_defaults(_DEFAULT_LOG_LEVELS)
log.register_options(CONF)
gmr.TextGuruMeditation.setup_autorun(version)
utils.register_plugin_opts()
if argv is None:
argv = sys.argv
CONF(argv[1:], project='searchlight')
log.setup(cfg.CONF, 'searchlight')
oslo_messaging.set_transport_defaults('searchlight')
示例3: setup
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def setup():
# Set the default exchange under which topics are scoped
oslo_msg.set_transport_defaults('vitrage')
示例4: setup
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def setup():
oslo_messaging.set_transport_defaults('cloudkitty')
示例5: main
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def main(manager='tacker.conductor.conductor_server.Conductor'):
init(sys.argv[1:])
objects.register_all()
logging.setup(CONF, "tacker")
oslo_messaging.set_transport_defaults(control_exchange='tacker')
logging.setup(CONF, "tacker")
CONF.log_opt_values(LOG, logging.DEBUG)
server = tacker_service.Service.create(
binary='tacker-conductor',
topic=topics.TOPIC_CONDUCTOR,
manager=manager)
service.launch(CONF, server, restart_method='mutate').wait()
示例6: setup
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def setup(url=None, optional=False):
"""Initialise the oslo_messaging layer."""
global TRANSPORT, GLOBAL_TRANSPORT, NOTIFIER
if url and url.startswith("fake://"):
# NOTE: oslo_messaging fake driver uses time.sleep
# for task switch, so we need to monkey_patch it
eventlet.monkey_patch(time=True)
messaging.set_transport_defaults('senlin')
if not TRANSPORT:
exmods = ['senlin.common.exception']
try:
TRANSPORT = messaging.get_rpc_transport(
cfg.CONF, url, allowed_remote_exmods=exmods)
except messaging.InvalidTransportURL as e:
TRANSPORT = None
if not optional or e.url:
# NOTE: oslo_messaging is configured but unloadable
# so reraise the exception
raise
if not NOTIFIER:
exmods = ['senlin.common.exception']
try:
NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
cfg.CONF, allowed_remote_exmods=exmods)
except Exception:
raise
serializer = RequestContextSerializer(JsonPayloadSerializer())
NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
serializer=serializer,
topics=cfg.CONF.notification_topics)
示例7: setup
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def setup():
oslo_messaging.set_transport_defaults('aodh')
示例8: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def __init__(self, app, conf):
self._app = app
self.ignore_projects = self._get_ignore_projects(conf)
oslo_messaging.set_transport_defaults(conf.get('control_exchange',
'swift'))
self._notifier = oslo_messaging.Notifier(
oslo_messaging.get_notification_transport(cfg.CONF,
url=conf.get('url')),
publisher_id='ceilometermiddleware',
driver=conf.get('driver', 'messagingv2'),
topics=[conf.get('topic', 'notifications')])
self.metadata_headers = [h.strip().replace('-', '_').lower()
for h in conf.get(
"metadata_headers",
"").split(",") if h.strip()]
self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_')
if self.reseller_prefix and self.reseller_prefix[-1] != '_':
self.reseller_prefix += '_'
LOG.setLevel(getattr(logging, conf.get('log_level', 'WARNING')))
# NOTE: If the background thread's send queue fills up, the event will
# be discarded
#
# For backward compatibility we default to False and therefore wait for
# sending to complete. This causes swift proxy to hang if the
# destination is unavailable.
self.nonblocking_notify = strutils.bool_from_string(
conf.get('nonblocking_notify', False))
# Initialize the sending queue and thread, but only once
if self.nonblocking_notify and Swift.event_queue is None:
Swift.threadLock.acquire()
if Swift.event_queue is None:
send_queue_size = int(conf.get('send_queue_size', 1000))
Swift.event_queue = queue.Queue(send_queue_size)
self.start_sender_thread()
Swift.threadLock.release()