當前位置: 首頁>>代碼示例>>Python>>正文


Python oslo_messaging.set_transport_defaults方法代碼示例

本文整理匯總了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) 
開發者ID:openstack,項目名稱:zun,代碼行數:4,代碼來源:rpc.py

示例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') 
開發者ID:openstack,項目名稱:searchlight,代碼行數:14,代碼來源:service.py

示例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') 
開發者ID:openstack,項目名稱:vitrage,代碼行數:5,代碼來源:messaging.py

示例4: setup

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def setup():
    oslo_messaging.set_transport_defaults('cloudkitty') 
開發者ID:openstack,項目名稱:cloudkitty,代碼行數:4,代碼來源:messaging.py

示例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() 
開發者ID:openstack,項目名稱:tacker,代碼行數:14,代碼來源:conductor_server.py

示例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) 
開發者ID:openstack,項目名稱:senlin,代碼行數:36,代碼來源:messaging.py

示例7: setup

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import set_transport_defaults [as 別名]
def setup():
    oslo_messaging.set_transport_defaults('aodh') 
開發者ID:openstack,項目名稱:aodh,代碼行數:4,代碼來源:messaging.py

示例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() 
開發者ID:openstack,項目名稱:ceilometermiddleware,代碼行數:44,代碼來源:swift.py


注:本文中的oslo_messaging.set_transport_defaults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。