Python oslo_messaging.set_transport_defaults() Examples

The following are 16 code examples of oslo_messaging.set_transport_defaults(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module oslo_messaging , or try the search function .
Example #1
Source File: rpc.py    From zun with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #2
Source File: rpc.py    From designate with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #3
Source File: service.py    From searchlight with Apache License 2.0 5 votes vote down vote up
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') 
Example #4
Source File: rpc.py    From magnum with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #5
Source File: rpc.py    From manila with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #6
Source File: rpc.py    From masakari with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #7
Source File: messaging.py    From vitrage with Apache License 2.0 5 votes vote down vote up
def setup():
    # Set the default exchange under which topics are scoped
    oslo_msg.set_transport_defaults('vitrage') 
Example #8
Source File: rpc.py    From vitrage with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #9
Source File: messaging.py    From cloudkitty with Apache License 2.0 5 votes vote down vote up
def setup():
    oslo_messaging.set_transport_defaults('cloudkitty') 
Example #10
Source File: conductor_server.py    From tacker with Apache License 2.0 5 votes vote down vote up
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() 
Example #11
Source File: rpc.py    From watcher with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #12
Source File: messaging.py    From senlin with Apache License 2.0 5 votes vote down vote up
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) 
Example #13
Source File: rpc.py    From cyborg with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #14
Source File: messaging.py    From aodh with Apache License 2.0 5 votes vote down vote up
def setup():
    oslo_messaging.set_transport_defaults('aodh') 
Example #15
Source File: rpc.py    From karbor with Apache License 2.0 5 votes vote down vote up
def set_defaults(control_exchange):
    messaging.set_transport_defaults(control_exchange) 
Example #16
Source File: swift.py    From ceilometermiddleware with Apache License 2.0 4 votes vote down vote up
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()