Beispiel #1
0
def main():
    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    db_connection = storage.get_connection_from_config(conf)
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(PersistorService(conf, db_connection))
    launcher.wait()
Beispiel #2
0
def main():
    """Starts all the Entity graph services

    1. Starts the Entity graph service
    2. Starts the api_handler service
    3. Starts the datasource service
    4. Starts the Consistency service
    """

    conf = service.prepare_service()
    init_status = InitializationStatus()
    mp_queue, evaluator_queue, evaluator, e_graph = init(conf)
    launcher = os_service.ServiceLauncher(conf)
    datasources = datasource_launcher.Launcher(
        conf, datasource_launcher.create_send_to_queue_callback(mp_queue))

    launcher.launch_service(
        entity_graph_svc.VitrageGraphService(conf, mp_queue, evaluator_queue,
                                             evaluator, e_graph, init_status))

    launcher.launch_service(
        api_handler_svc.VitrageApiHandlerService(conf, e_graph,
                                                 evaluator.scenario_repo))

    datasources.launch()

    launcher.launch_service(
        consistency_svc.VitrageGraphConsistencyService(conf, evaluator_queue,
                                                       evaluator, e_graph,
                                                       init_status))

    launcher.wait()
def main_service():
    """Method to use with Openstack service."""
    ConfigInitializer.basic_config()
    LogUtils.init_logger(__name__)
    launcher = os_service.ServiceLauncher(cfg.CONF, restart_method='mutate')
    launcher.launch_service(Transform())
    launcher.wait()
Beispiel #4
0
def main(args=sys.argv[1:]):
    # Parse config file and command line options, then start logging
    service_utils.prepare_service(args)

    launcher = service.ServiceLauncher(CONF, restart_method='mutate')
    launcher.launch_service(wsgi_service.WSGIService())
    launcher.launch_service(RPCService(CONF.host))
    launcher.wait()
Beispiel #5
0
def main():
    """Starts all the datasources drivers services"""

    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(ListenerService(conf))
    launcher.launch_service(CollectorRpcHandlerService(conf))
    launcher.wait()
Beispiel #6
0
def launch_event_engine():
    try:
        launcher = service.ServiceLauncher(CONF)

        launcher.launch_service(event_engine_server.get_oslo_service())

        launcher.wait()
    except RuntimeError as e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #7
0
def main():
    try:
        config.parse_args()
        logging.setup(CONF, 'muranoagent')
        launcher = service.ServiceLauncher(CONF)
        launcher.launch_service(app.MuranoAgent())
        launcher.wait()
    except RuntimeError as e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #8
0
def launch_thread(server, workers=1):
    try:
        global SERVER_THREAD_MANAGER

        if not SERVER_THREAD_MANAGER:
            SERVER_THREAD_MANAGER = service.ServiceLauncher(CONF)

        SERVER_THREAD_MANAGER.launch_service(server, workers=workers)
    except Exception as e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #9
0
def thread_launch(server):
    try:
        global THREAD_LAUNCHER

        if THREAD_LAUNCHER is None:
            THREAD_LAUNCHER = service.ServiceLauncher(CONF)

        THREAD_LAUNCHER.launch_service(server)
    except Exception as exc:
        LOG.error(exc)
        sys.exit(1)
Beispiel #10
0
def main(args=sys.argv[1:]):
    # Parse config file and command line options, then start logging
    service_utils.prepare_service(args)

    if CONF.standalone:
        msg = _('To run ironic-inspector-conductor, [DEFAULT]standalone '
                'should be set to False.')
        sys.exit(msg)

    launcher = service.ServiceLauncher(CONF, restart_method='mutate')
    launcher.launch_service(RPCService(CONF.host))
    launcher.wait()
Beispiel #11
0
def main():
    """Starts all the datasources drivers services"""

    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    rabbitmq = CollectorNotifier(conf)
    callback = datasource_launcher.create_send_to_queue_callback(rabbitmq)
    launcher.launch_service(
        ListenerService(conf, utils.get_drivers(conf), callback))

    datasources = datasource_launcher.Launcher(conf, callback)
    datasources.launch()

    launcher.wait()
Beispiel #12
0
def _start_workers(workers, neutron_api=None):
    process_workers = [
        plugin_worker for plugin_worker in workers
        if plugin_worker.worker_process_count > 0
    ]

    try:
        if process_workers:
            # Get eventual already existing instance from WSGI app
            worker_launcher = None
            if neutron_api:
                worker_launcher = neutron_api.wsgi_app.process_launcher
            if worker_launcher is None:
                worker_launcher = common_service.ProcessLauncher(
                    cfg.CONF, wait_interval=1.0, restart_method='mutate'
                )

            # add extra process worker and spawn there all workers with
            # worker_process_count == 0
            thread_workers = [
                plugin_worker for plugin_worker in workers
                if plugin_worker.worker_process_count < 1
            ]
            if thread_workers:
                process_workers.append(
                    AllServicesNeutronWorker(thread_workers)
                )

            # dispose the whole pool before os.fork, otherwise there will
            # be shared DB connections in child processes which may cause
            # DB errors.
            session.get_context_manager().dispose_pool()

            for worker in process_workers:
                worker_launcher.launch_service(worker,
                                               worker.worker_process_count)
        else:
            worker_launcher = common_service.ServiceLauncher(cfg.CONF)
            for worker in workers:
                worker_launcher.launch_service(worker)
        return worker_launcher
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception('Unrecoverable error: please check log for '
                          'details.')
Beispiel #13
0
def serve(*servers):
    if max([server[1].workers for server in servers]) > 1:
        # TODO(arosen) - need to provide way to communicate with DSE services
        launcher = service.ProcessLauncher(cfg.CONF, restart_method='mutate')
    else:
        launcher = service.ServiceLauncher(cfg.CONF, restart_method='mutate')

    for name, server in servers:
        try:
            server.launch_with(launcher)
        except socket.error:
            LOG.exception(_('Failed to start the %s server'), name)
            raise

    try:
        launcher.wait()
    except KeyboardInterrupt:
        LOG.info("Congress server stopped by interrupt.")
Beispiel #14
0
def serve(*servers):
    if max([server[1].workers for server in servers]) > 1:
        launcher = service.ProcessLauncher(CONF)
    else:
        launcher = service.ServiceLauncher(CONF)

    for name, server in servers:
        try:
            server.launch_with(launcher)
        except socket.error:
            logging.exception("Failed to start the %(name)s server" %
                              {"name": name})
            raise

    # notify calling process we are ready to serve
    systemd.notify_once()

    for name, server in servers:
        launcher.wait()
Beispiel #15
0
def main():
    try:
        config.parse_args()
        logging.setup(CONF, 'murano-cfapi')
        request_statistics.init_stats()
        policy.init()

        launcher = service.ServiceLauncher(CONF)

        cfapp = app_loader.load_paste_app('cloudfoundry')
        cfport, cfhost = (config.CONF.cfapi.bind_port,
                          config.CONF.cfapi.bind_host)

        launcher.launch_service(wsgi.Service(cfapp, cfport, cfhost))

        launcher.wait()
    except RuntimeError as e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #16
0
def _start_workers(workers):
    process_workers = [
        plugin_worker for plugin_worker in workers
        if plugin_worker.worker_process_count > 0
    ]

    try:
        if process_workers:
            worker_launcher = common_service.ProcessLauncher(
                cfg.CONF, wait_interval=1.0
            )

            # add extra process worker and spawn there all workers with
            # worker_process_count == 0
            thread_workers = [
                plugin_worker for plugin_worker in workers
                if plugin_worker.worker_process_count < 1
            ]
            if thread_workers:
                process_workers.append(
                    AllServicesNeutronWorker(thread_workers)
                )

            # dispose the whole pool before os.fork, otherwise there will
            # be shared DB connections in child processes which may cause
            # DB errors.
            session.context_manager.dispose_pool()

            for worker in process_workers:
                worker_launcher.launch_service(worker,
                                               worker.worker_process_count)
        else:
            worker_launcher = common_service.ServiceLauncher(cfg.CONF)
            for worker in workers:
                worker_launcher.launch_service(worker)
        return worker_launcher
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception(_LE('Unrecoverable error: please check log for '
                              'details.'))
Beispiel #17
0
def main():
    try:
        config.parse_args()
        request_statistics.init_stats()
        policy.init()

        logging.setup(CONF, 'murano')
        launcher = service.ServiceLauncher(CONF)

        app = app_loader.load_paste_app('murano')
        port, host = (CONF.bind_port, CONF.bind_host)

        launcher.launch_service(wsgi.Service(app, port, host))

        launcher.launch_service(server.get_rpc_service())
        launcher.launch_service(server.get_notification_service())
        launcher.launch_service(stats.StatsCollectingService())

        launcher.wait()
    except RuntimeError as e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #18
0
def main():
    """Starts all the Entity graph services

    1. Starts the Entity graph service
    2. Starts the api_handler service
    3. Starts the Consistency service
    """

    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    e_graph = entity_graph.get_graph_driver(conf)('Entity Graph')
    launcher = os_service.ServiceLauncher(conf)
    full_scenario_repo = ScenarioRepository(conf)
    clear_db(conf)

    launcher.launch_service(VitrageGraphService(conf, e_graph))

    launcher.launch_service(
        VitrageApiHandlerService(conf, e_graph, full_scenario_repo))

    launcher.launch_service(VitrageConsistencyService(conf, e_graph))

    launcher.wait()
Beispiel #19
0
def serve(*servers):
    logging.warning(_('Running keystone via eventlet is deprecated as of Kilo '
                      'in favor of running in a WSGI server (e.g. mod_wsgi). '
                      'Support for keystone under eventlet will be removed in '
                      'the "M"-Release.'))
    if max([server[1].workers for server in servers]) > 1:
        launcher = service.ProcessLauncher(CONF)
    else:
        launcher = service.ServiceLauncher(CONF)

    for name, server in servers:
        try:
            server.launch_with(launcher)
        except socket.error:
            logging.exception(_('Failed to start the %(name)s server') % {
                'name': name})
            raise

    # notify calling process we are ready to serve
    systemd.notify_once()

    for name, server in servers:
        launcher.wait()
Beispiel #20
0
def launch_service(s):
    launcher = service.ServiceLauncher(cfg.CONF)

    launcher.launch_service(s)

    launcher.wait()
Beispiel #21
0
def process_launcher():
    # return service.ProcessLauncher(CONF, restart_method='mutate')
    return service.ServiceLauncher(CONF, restart_method='reload')
Beispiel #22
0
def process_launcher():
    return service.ServiceLauncher(CONF, restart_method='reload')
Beispiel #23
0
def main():
    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(SnmpParsingService(conf))
    launcher.wait()
Beispiel #24
0
def main():
    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(MachineLearningService(conf))
    launcher.wait()
Beispiel #25
0
        time.sleep(0.2)

    def start(self):
        print("%s: %s start is called." % (timeutils.strtime(), self.id))
        time.sleep(0.2)

    def stop(self):
        print("%s: %s stop is called." % (timeutils.strtime(), self.id))
        time.sleep(0.2)

    def wait(self):
        print("%s: %s wait is called." % (timeutils.strtime(), self.id))
        time.sleep(0.2)


from oslo_config import cfg
from oslo_service import service

CONF = cfg.CONF

print("=====================================")
service_launcher = service.ServiceLauncher(CONF)
service_launcher.launch_service(SampleService())

print("=====================================")
process_launcher = service.ProcessLauncher(CONF, wait_interval=1.0)
process_launcher.launch_service(service.Service(), workers=2)

print("=====================================")
launcher = service.launch(CONF, SampleService(), workers=3)
Beispiel #26
0
def main():
    print(VITRAGE_TITLE)
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(VitrageNotifierService(conf))
    launcher.wait()
Beispiel #27
0
def main():
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(StressNotificationsService(conf))
    launcher.wait()
Beispiel #28
0
def main():
    conf = service.prepare_service()
    launcher = os_service.ServiceLauncher(conf)
    launcher.launch_service(VitrageNotifierService(conf))
    launcher.wait()