コード例 #1
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    register_options()
    service.launch(config.CONF,
                   notification.NotificationService(),
                   config.CONF.infoblox.ipam_agent_workers).wait()
コード例 #2
0
def main():
    try:
        config.setup_remote_pydev_debug()

        CONF = config.CONF
        CONF(sys.argv[1:], project='barbican',
             version=version.version_info.version_string)

        # Import and configure logging.
        log.setup(CONF, 'barbican')

        LOG = log.getLogger(__name__)
        LOG.info("Booting up Barbican Keystone listener node...")

        # Queuing initialization
        queue.init(CONF)

        if getattr(getattr(CONF, queue.KS_NOTIFICATIONS_GRP_NAME), 'enable'):
            service.launch(
                CONF,
                keystone_listener.MessageServer(CONF),
                restart_method='mutate'
            ).wait()
        else:
            LOG.info("Exiting as Barbican Keystone listener is not enabled...")
    except RuntimeError as e:
        fail(1, e)
コード例 #3
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-fastpath-agent',
        topic="FP_AGENT",
        report_interval=30,
        manager='networking_6wind.agent.server.NeutronFastPathAgent')
    service.launch(cfg.CONF, server).wait()
コード例 #4
0
ファイル: dhcp_agent.py プロジェクト: annp/neutron
def main():
    register_options(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-dhcp-agent',
        topic=topics.DHCP_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.agent.dhcp.agent.DhcpAgentWithStateReport')
    service.launch(cfg.CONF, server).wait()
コード例 #5
0
ファイル: l3_agent.py プロジェクト: 2020human/neutron
def main(manager='neutron.agent.l3.agent.L3NATAgentWithStateReport'):
    register_opts(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-l3-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(cfg.CONF, server).wait()
コード例 #6
0
def launch(binary, manager, topic=None):
    cfg.CONF(project='neutron')
    common_cfg.init(sys.argv[1:])
    config.setup_logging()
    report_period = cfg.CONF.ml2_cisco_apic.apic_agent_report_interval
    poll_period = cfg.CONF.ml2_cisco_apic.apic_agent_poll_interval
    server = service.Service.create(
        binary=binary, manager=manager, topic=topic,
        report_interval=report_period, periodic_interval=poll_period)
    svc.launch(server).wait()
コード例 #7
0
def main():
    register_options()
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-bgp-dragent',
        topic=bgp_consts.BGP_DRAGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron_dynamic_routing.services.bgp.agent.bgp_dragent.'
                'BgpDrAgentWithStateReport')
    service.launch(cfg.CONF, server).wait()
コード例 #8
0
ファイル: consumer.py プロジェクト: johnsom/octavia
 def listen(self):
     try:
         LOG.info(_LI('Starting consumer...'))
         service.launch(cfg.CONF, self.server).wait()
     finally:
         LOG.info(_LI('Stopping consumer...'))
         self.server.stop()
         LOG.info(_LI('Consumer successfully stopped.  Waiting for final '
                      'messages to be processed...'))
         self.server.wait()
         LOG.info(_LI('Finished waiting.'))
コード例 #9
0
ファイル: conductor_server.py プロジェクト: openstack/tacker
def main(manager='tacker.conductor.conductor_server.Conductor'):
    init(sys.argv[1:])
    objects.register_all()
    logging.setup(cfg.CONF, "tacker")
    oslo_messaging.set_transport_defaults(control_exchange='tacker')
    logging.setup(cfg.CONF, "tacker")
    cfg.CONF.log_opt_values(LOG, logging.DEBUG)
    server = tacker_service.Service.create(
        binary='tacker-conductor',
        topic=topics.TOPIC_CONDUCTOR,
        manager=manager)
    service.launch(cfg.CONF, server, restart_method='mutate').wait()
コード例 #10
0
ファイル: l3_sdn_agent.py プロジェクト: xujinrong/dragonflow
def main(manager='dragonflow.neutron.agent.l3.l3_controller_agent.'
         'L3ControllerAgentWithStateReport'):
    l3_agent.register_opts(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    cfg.CONF.set_override('router_delete_namespaces', True)
    server = neutron_service.Service.create(
        binary='neutron-l3-controller-agent',
        topic=topics.L3_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager=manager)
    service.launch(cfg.CONF, server).wait()
コード例 #11
0
ファイル: metering_agent.py プロジェクト: dhanunjaya/neutron
def main():
    conf = cfg.CONF
    conf.register_opts(MeteringAgent.Opts)
    config.register_agent_state_opts_helper(conf)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-metering-agent',
        topic=topics.METERING_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.services.metering.agents.'
                'metering_agent.MeteringAgentWithStateReport')
    service.launch(cfg.CONF, server).wait()
コード例 #12
0
def main():
    config.register_ovsdb_opts_helper(cfg.CONF)
    agent_config.register_agent_state_opts_helper(cfg.CONF)
    common_config.init(sys.argv[1:])
    config.setup_logging()

    mgr = manager.OVSDBManager(cfg.CONF)
    svc = L2gatewayAgentService(
        host=cfg.CONF.host,
        topic=topics.L2GATEWAY_AGENT,
        manager=mgr
    )
    service.launch(cfg.CONF, svc).wait()
コード例 #13
0
ファイル: agent.py プロジェクト: bdrich/neutron-lbaas
def main():
    cfg.CONF.register_opts(OPTS)
    cfg.CONF.register_opts(manager.OPTS)
    # import interface options just in case the driver uses namespaces
    cfg.CONF.register_opts(interface.OPTS)
    config.register_interface_driver_opts_helper(cfg.CONF)
    config.register_agent_state_opts_helper(cfg.CONF)

    common_config.init(sys.argv[1:])
    config.setup_logging()

    mgr = manager.LbaasAgentManager(cfg.CONF)
    svc = LbaasAgentService(host=cfg.CONF.host, topic=l_const.LOADBALANCER_AGENT, manager=mgr)
    service.launch(cfg.CONF, svc).wait()
コード例 #14
0
ファイル: agent.py プロジェクト: openstack/congress
def main():
    """Agent entry point"""
    validator_opts.register_validator_agent_opts(cfg.CONF)
    config.init(sys.argv[1:])
    config.setup_logging()

    if not cfg.CONF.config_file:
        sys.exit("ERROR: Unable to find configuration file via default "
                 "search paths ~/.congress/, ~/, /etc/congress/, /etc/) and "
                 "the '--config-file' option!")

    agent = ValidatorAgentEndpoint()
    server = rpc.AgentService(utils.AGENT_TOPIC, [agent])
    service.launch(agent.conf, server).wait()
コード例 #15
0
ファイル: worker.py プロジェクト: unibg-seclab/barbican
def main():
    try:
        CONF = config.CONF

        # Import and configure logging.
        log.setup(CONF, "barbican")
        LOG = log.getLogger(__name__)
        LOG.debug("Booting up Barbican worker node...")

        # Queuing initialization
        queue.init(CONF)

        service.launch(CONF, server.TaskServer(), workers=CONF.queue.asynchronous_workers).wait()
    except RuntimeError as e:
        fail(1, e)
コード例 #16
0
ファイル: conductor.py プロジェクト: AvnishPal/magnum
def main():
    magnum_service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    LOG.info(_LI('Starting server in PID %s'), os.getpid())
    LOG.debug("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.DEBUG)

    cfg.CONF.import_opt('topic', 'magnum.conductor.config', group='conductor')

    conductor_id = short_id.generate_id()
    endpoints = [
        indirection_api.Handler(),
        docker_conductor.Handler(),
        k8s_conductor.Handler(),
        bay_conductor.Handler(),
        conductor_listener.Handler(),
        ca_conductor.Handler(),
    ]

    if (not os.path.isfile(cfg.CONF.bay.k8s_atomic_template_path)
            and not os.path.isfile(cfg.CONF.bay.k8s_coreos_template_path)):
        LOG.error(_LE("The Heat template can not be found for either k8s "
                      "atomic %(atomic_template)s or coreos "
                      "%(coreos_template)s. Install template first if you "
                      "want to create bay.") %
                  {'atomic_template': cfg.CONF.bay.k8s_atomic_template_path,
                   'coreos_template': cfg.CONF.bay.k8s_coreos_template_path})

    server = rpc_service.Service.create(cfg.CONF.conductor.topic,
                                        conductor_id, endpoints,
                                        binary='magnum-conductor')
    launcher = service.launch(cfg.CONF, server)
    launcher.wait()
コード例 #17
0
ファイル: conductor.py プロジェクト: HackToday/magnum
def main():
    logging.register_options(cfg.CONF)
    cfg.CONF(sys.argv[1:], project='magnum')
    logging.setup(cfg.CONF, 'magnum')

    LOG.info(_LI('Starting server in PID %s') % os.getpid())
    LOG.debug("Configuration:")
    cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)

    cfg.CONF.import_opt('topic', 'magnum.conductor.config', group='conductor')

    conductor_id = short_id.generate_id()
    endpoints = [
        docker_conductor.Handler(),
        k8s_conductor.Handler(),
        bay_conductor.Handler(),
        conductor_listener.Handler(),
    ]

    if (not os.path.isfile(cfg.CONF.bay.k8s_atomic_template_path)
            and not os.path.isfile(cfg.CONF.bay.k8s_coreos_template_path)):
        LOG.error(_LE("The Heat template can not be found for either k8s "
                      "atomic %(atomic_template)s or coreos "
                      "(coreos_template)%s. Install template first if you "
                      "want to create bay.") %
                  {'atomic_template': cfg.CONF.bay.k8s_atomic_template_path,
                   'coreos_template': cfg.CONF.bay.k8s_coreos_template_path})

    server = rpc_service.Service.create(cfg.CONF.conductor.topic,
                                        conductor_id, endpoints)
    launcher = service.launch(cfg.CONF, server)
    launcher.wait()
コード例 #18
0
ファイル: bank_services.py プロジェクト: jnpr-shinma/bank
def server_main():
    import cgitb
    cgitb.enable(format='text')
    cfg.CONF()
    srv = BankRPC()
    launcher = service.launch(cfg.CONF, srv)
    launcher.wait()
コード例 #19
0
ファイル: conductor.py プロジェクト: gwdg/magnum
def main():
    magnum_service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    LOG.info(_LI('Starting server in PID %s'), os.getpid())
    LOG.debug("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.DEBUG)

    cfg.CONF.import_opt('topic', 'magnum.conductor.config', group='conductor')

    conductor_id = short_id.generate_id()
    endpoints = [
        indirection_api.Handler(),
        docker_conductor.Handler(),
        k8s_conductor.Handler(),
        bay_conductor.Handler(),
        conductor_listener.Handler(),
        ca_conductor.Handler(),
    ]

    server = rpc_service.Service.create(cfg.CONF.conductor.topic,
                                        conductor_id, endpoints,
                                        binary='magnum-conductor')
    launcher = service.launch(cfg.CONF, server)
    launcher.wait()
コード例 #20
0
    def post_launch(self):
        """Post processing after workers launch.

            Tasks which needs to run only on distributor
            process and any other resources which are not
            expected to be forked are initialized here.
        """
        self._update_manager()

        # create and launch rpc service agent for each topic
        for key, value in six.iteritems(self._rpc_agents):
            agents = value['agents']
            # Register NFP RPC managers in priority order,
            # so that on rpc, oslo invokes them in the given order,
            # This is required for NFP where multiple managers of
            # different priority register for same rpc.
            sorted_agents = sorted(
                agents, key=operator.attrgetter('priority'), reverse=True)
            rpc_managers = [agent.manager for agent in sorted_agents]
            service = nfp_rpc.RpcService(topic=key, managers=rpc_managers)
            # Launch rpc_service_agent
            # Use threads for launching service
            launcher = oslo_service.launch(
                self._conf, service, workers=None)

            self._rpc_agents[key]['service'] = service
            self._rpc_agents[key]['launcher'] = launcher

        # One task to manage the resources - workers & events.
        eventlet.spawn_n(self._manager_task)
        eventlet.spawn_n(self._resending_task)
        # Oslo periodic task for state reporting
        nfp_rpc.ReportStateTask(self._conf, self)
コード例 #21
0
ファイル: guest.py プロジェクト: paramtech/tesora-trove
def main():
    cfg.parse_args(sys.argv)
    logging.setup(CONF, None)

    debug_utils.setup()

    # Patch 'thread' module if debug is disabled
    if not debug_utils.enabled():
        eventlet.monkey_patch(thread=True)

    from trove.guestagent import dbaas
    manager = dbaas.datastore_registry().get(CONF.datastore_manager)
    if not manager:
        msg = ("Manager class not registered for datastore manager %s" %
               CONF.datastore_manager)
        raise RuntimeError(msg)

    # rpc module must be loaded after decision about thread monkeypatching
    # because if thread module is not monkeypatched we can't use eventlet
    # executor from oslo_messaging library.
    from trove import rpc
    rpc.init(CONF)

    from trove.common.rpc import service as rpc_service
    from trove.common.rpc import version as rpc_version
    server = rpc_service.RpcService(
        manager=manager, host=CONF.guest_id,
        rpc_api_version=rpc_version.RPC_API_VERSION)

    launcher = openstack_service.launch(CONF, server)
    launcher.wait()
コード例 #22
0
ファイル: engine.py プロジェクト: Hopebaytech/heat
def main():
    logging.register_options(cfg.CONF)
    cfg.CONF(project='heat', prog='heat-engine',
             version=version.version_info.version_string())
    logging.setup(cfg.CONF, 'heat-engine')
    logging.set_defaults()
    messaging.setup()

    config.startup_sanity_check()

    mgr = None
    try:
        mgr = template._get_template_extension_manager()
    except template.TemplatePluginNotRegistered as ex:
        LOG.critical(_LC("%s"), ex)
    if not mgr or not mgr.names():
        sys.exit("ERROR: No template format plugins registered")

    from heat.engine import service as engine  # noqa

    profiler.setup('heat-engine', cfg.CONF.host)
    gmr.TextGuruMeditation.setup_autorun(version)
    srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
    workers = cfg.CONF.num_engine_workers
    if not workers:
        workers = max(4, processutils.get_worker_count())

    launcher = service.launch(cfg.CONF, srv, workers=workers)
    if cfg.CONF.enable_cloud_watch_lite:
        # We create the periodic tasks here, which mean they are created
        # only in the parent process when num_engine_workers>1 is specified
        srv.create_periodic_tasks()
    launcher.wait()
コード例 #23
0
 def _spawn_service(self, workers=1, *args, **kwargs):
     self.workers = workers
     pid = os.fork()
     if pid == 0:
         os.setsid()
         # NOTE(johannes): We can't let the child processes exit back
         # into the unit test framework since then we'll have multiple
         # processes running the same tests (and possibly forking more
         # processes that end up in the same situation). So we need
         # to catch all exceptions and make sure nothing leaks out, in
         # particular SystemExit, which is raised by sys.exit(). We use
         # os._exit() which doesn't have this problem.
         status = 0
         try:
             serv = ServiceWithTimer()
             launcher = service.launch(self.conf, serv, workers=workers)
             launcher.wait(*args, **kwargs)
         except SystemExit as exc:
             status = exc.code
         except BaseException:
             # We need to be defensive here too
             try:
                 traceback.print_exc()
             except BaseException:
                 print("Couldn't print traceback")
             status = 2
         # Really exit
         os._exit(status)
     return pid
コード例 #24
0
ファイル: conductor.py プロジェクト: openstack/magnum
def main():
    magnum_service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    LOG.info('Starting server in PID %s', os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    conductor_id = short_id.generate_id()
    endpoints = [
        indirection_api.Handler(),
        cluster_conductor.Handler(),
        conductor_listener.Handler(),
        ca_conductor.Handler(),
        federation_conductor.Handler(),
    ]

    server = rpc_service.Service.create(CONF.conductor.topic,
                                        conductor_id, endpoints,
                                        binary='magnum-conductor')
    workers = CONF.conductor.workers
    if not workers:
        workers = processutils.get_worker_count()
    launcher = service.launch(CONF, server, workers=workers)

    # NOTE(mnaser): We create the periodic tasks here so that they
    #               can be attached to the main process and not
    #               duplicated in all the children if multiple
    #               workers are being used.
    server.create_periodic_tasks()
    server.start()

    launcher.wait()
コード例 #25
0
def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    try:
        interface_mappings = n_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing physical_interface_mappings failed: %s. "
                      "Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_LI("Interface mappings: %s"), interface_mappings)

    try:
        bridge_mappings = n_utils.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.bridge_mappings)
    except ValueError as e:
        LOG.error(_LE("Parsing bridge_mappings failed: %s. "
                      "Agent terminated!"), e)
        sys.exit(1)
    LOG.info(_LI("Bridge mappings: %s"), bridge_mappings)

    manager = LinuxBridgeManager(bridge_mappings, interface_mappings)

    polling_interval = cfg.CONF.AGENT.polling_interval
    quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout
    agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout,
                               constants.AGENT_TYPE_LINUXBRIDGE,
                               LB_AGENT_BINARY)
    LOG.info(_LI("Agent initialized successfully, now running... "))
    launcher = service.launch(cfg.CONF, agent)
    launcher.wait()
コード例 #26
0
ファイル: driver.py プロジェクト: F5Networks/neutron-lbaas
    def __init__(self, plugin):
        super(OctaviaDriver, self).__init__(plugin)
        self.req = OctaviaRequest(cfg.CONF.octavia.base_url,
                                  keystone.get_session())

        self.load_balancer = LoadBalancerManager(self)
        self.listener = ListenerManager(self)
        self.pool = PoolManager(self)
        self.member = MemberManager(self)
        self.health_monitor = HealthMonitorManager(self)
        self.l7policy = L7PolicyManager(self)
        self.l7rule = L7RuleManager(self)
        self.octavia_consumer = octavia_messaging_consumer.OctaviaConsumer(
            self)
        service.launch(cfg.CONF, self.octavia_consumer)
        LOG.debug("OctaviaDriver: initialized, version=%s", VERSION)
コード例 #27
0
ファイル: guest.py プロジェクト: Tesora/tesora-trove
def main():
    cfg.parse_args(sys.argv)
    logging.setup(CONF, None)
    debug_utils.setup()

    from trove.guestagent import dbaas
    manager = dbaas.datastore_registry().get(CONF.datastore_manager)
    if not manager:
        msg = (_LE("Manager class not registered for datastore manager %s") %
               CONF.datastore_manager)
        raise RuntimeError(msg)

    if not CONF.guest_id:
        msg = (_LE("The guest_id parameter is not set. guest_info.conf "
               "was not injected into the guest or not read by guestagent"))
        raise RuntimeError(msg)

    # BUG(1650518): Cleanup in the Pike release
    # make it fatal if CONF.instance_rpc_encr_key is None

    # rpc module must be loaded after decision about thread monkeypatching
    # because if thread module is not monkeypatched we can't use eventlet
    # executor from oslo_messaging library.
    from trove import rpc
    rpc.init(CONF)

    from trove.common.rpc import service as rpc_service
    server = rpc_service.RpcService(
        key=CONF.instance_rpc_encr_key,
        topic="guestagent.%s" % CONF.guest_id,
        manager=manager, host=CONF.guest_id,
        rpc_api_version=guest_api.API.API_LATEST_VERSION)

    launcher = openstack_service.launch(CONF, server)
    launcher.wait()
コード例 #28
0
ファイル: service.py プロジェクト: andymcc/nova
def serve(server, workers=None):
    global _launcher
    if _launcher:
        raise RuntimeError(_('serve() can only be called once'))

    _launcher = service.launch(CONF, server, workers=workers,
                               restart_method='mutate')
コード例 #29
0
ファイル: engine.py プロジェクト: noironetworks/heat
def launch_engine(setup_logging=True):
    if setup_logging:
        logging.register_options(cfg.CONF)
    cfg.CONF(project='heat', prog='heat-engine',
             version=version.version_info.version_string())
    if setup_logging:
        logging.setup(cfg.CONF, 'heat-engine')
        logging.set_defaults()
    messaging.setup()

    config.startup_sanity_check()

    mgr = None
    try:
        mgr = template._get_template_extension_manager()
    except template.TemplatePluginNotRegistered as ex:
        LOG.critical("%s", ex)
    if not mgr or not mgr.names():
        sys.exit("ERROR: No template format plugins registered")

    from heat.engine import service as engine  # noqa

    profiler.setup('heat-engine', cfg.CONF.host)
    gmr.TextGuruMeditation.setup_autorun(version)
    srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
    workers = cfg.CONF.num_engine_workers
    if not workers:
        workers = max(4, processutils.get_worker_count())

    launcher = service.launch(cfg.CONF, srv, workers=workers,
                              restart_method='mutate')
    return launcher
コード例 #30
0
def main():
    common_config.init(sys.argv[1:])

    common_config.setup_logging()
    agent_config.setup_privsep()
    try:
        interface_mappings = helpers.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
    except ValueError as e:
        LOG.error("Parsing physical_interface_mappings failed: %s. "
                  "Agent terminated!", e)
        sys.exit(1)
    LOG.info("Interface mappings: %s", interface_mappings)

    try:
        bridge_mappings = helpers.parse_mappings(
            cfg.CONF.LINUX_BRIDGE.bridge_mappings)
    except ValueError as e:
        LOG.error("Parsing bridge_mappings failed: %s. "
                  "Agent terminated!", e)
        sys.exit(1)
    LOG.info("Bridge mappings: %s", bridge_mappings)

    manager = LinuxBridgeManager(bridge_mappings, interface_mappings)
    linuxbridge_capabilities.register()

    polling_interval = cfg.CONF.AGENT.polling_interval
    quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout
    agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout,
                               constants.AGENT_TYPE_LINUXBRIDGE,
                               LB_AGENT_BINARY)
    setup_profiler.setup("neutron-linuxbridge-agent", cfg.CONF.host)
    LOG.info("Agent initialized successfully, now running... ")
    launcher = service.launch(cfg.CONF, agent, restart_method='mutate')
    launcher.wait()
コード例 #31
0
ファイル: service.py プロジェクト: zongzw-learn/learn-oslo
        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)
コード例 #32
0
def main():
    ## doc says that we should use more than 1 worker
    launcher = service.launch(cfg.CONF, EipNetworkingAgentService(), workers=4)
    launcher.wait()
コード例 #33
0
def main():
    service.prepare_service()
    os_service.launch(CONF,
                      notification.NotificationService(),
                      workers=service.get_workers('notification')).wait()
コード例 #34
0
def main():
    service.prepare_service()
    os_service.launch(CONF, notification.NotificationService(),
                      workers=CONF.notification.workers).wait()
コード例 #35
0
ファイル: alarm.py プロジェクト: bopopescu/OpenstackLiberty
def evaluator():
    service.prepare_service()
    os_service.launch(CONF, alarm_service.AlarmEvaluationService()).wait()
コード例 #36
0
def main():
    service.prepare_service()
    os_service.launch(
        CONF, manager.AgentManager(CONF.polling_namespaces,
                                   CONF.pollster_list)).wait()
コード例 #37
0
def main():
    service.prepare_service()
    os_service.launch(CONF,
                      collector.CollectorService(),
                      workers=CONF.collector.workers).wait()
コード例 #38
0
def launch(conf, service_, workers=1, restart_method='reload'):
    return service.launch(conf, service_, workers, restart_method)
コード例 #39
0
def evaluator():
    conf = service.prepare_service()
    os_service.launch(conf, evaluator_svc.AlarmEvaluationService(conf)).wait()
コード例 #40
0
def notifier():
    conf = service.prepare_service()
    os_service.launch(conf, notifier_svc.AlarmNotifierService(conf)).wait()
コード例 #41
0
def launch_api():
    server = api_service.WSGIService('qinling_api')
    launcher = service.launch(CONF, server, workers=server.workers)
    launcher.wait()
コード例 #42
0
def main():
    config.init()
    launcher = service.launch(CONF, ServiceManager())
    launcher.wait()
コード例 #43
0
ファイル: base.py プロジェクト: fabrickit/fabkit
def agent():
    server = AgentService()
    lancher = service.launch(CONF, server, workers=1)
    lancher.wait()
コード例 #44
0
def serve(api_service, conf, workers):
    global _launcher
    if _launcher:
        raise 'error'

    _launcher = service.launch(conf, api_service, workers=workers)
コード例 #45
0
def serve(api_service, conf, workers=1):
    global _launcher
    if _launcher:
        raise RuntimeError(_('serve() can only be called once'))

    _launcher = service.launch(conf, api_service, workers=workers)
コード例 #46
0
def start(argv):
    conf_base.init(sys.argv[1:])
    conf_base.setup_logging()
    clients.setup_clients()
    connector_launcher = service.launch(CONF, ConnectorService())
    connector_launcher.wait()
コード例 #47
0
ファイル: xservice.py プロジェクト: zwxhnu/trio2o
def serve(xservice, workers=1):
    global _launcher
    if _launcher:
        raise RuntimeError(_('serve() can only be called once'))

    _launcher = srv.launch(CONF, xservice, workers=workers)
コード例 #48
0
def main():
    flocx_market_service.prepare_service(sys.argv)

    service.launch(CONF,
                   manager_service.ManagerService(),
                   restart_method='mutate').wait()
コード例 #49
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    register_options()
    service.launch(config.CONF, notification.NotificationService(),
                   config.CONF.infoblox.ipam_agent_workers).wait()
コード例 #50
0
 def test_multiple_worker(self, mock_launch, alarm_mock):
     svc = service.Service()
     service.launch(self.conf, svc, workers=3)
     mock_launch.assert_called_with(svc, workers=3)
コード例 #51
0
 def _test_launch_single(self, workers, mock_launch):
     svc = service.Service()
     service.launch(self.conf, svc, workers=workers)
     mock_launch.assert_called_with(svc)
コード例 #52
0
ファイル: alarm.py プロジェクト: bopopescu/OpenstackLiberty
def notifier():
    service.prepare_service()
    os_service.launch(CONF, alarm_service.AlarmNotifierService()).wait()
コード例 #53
0
def main():
    service.prepare_service()
    os_service.launch(CONF,
                      collector.CollectorService(),
                      workers=service.get_workers('collector')).wait()
コード例 #54
0
ファイル: service.py プロジェクト: wisererik/delfin
def serve(server, workers=None):
    global _launcher
    if _launcher:
        raise RuntimeError('serve() can only be called once')
    _launcher = service.launch(CONF, server, workers=workers,
                               restart_method='mutate')
コード例 #55
0
def main():
    config.parse_args(sys.argv[1:], 'distil-collector')

    srv = collector.CollectorService()
    launcher = service.launch(cfg.CONF, srv)
    launcher.wait()
コード例 #56
0
ファイル: df_bgp_service.py プロジェクト: pinodeca/dragonflow
def main():
    df_config.init(sys.argv)
    nb_api = api_nb.NbApi.get_instance(False, True)
    server = BGPService(nb_api)
    df_service.register_service('df-bgp-service', nb_api, server)
    service.launch(cfg.CONF, server).wait()
コード例 #57
0
def serve(server, workers=None):
    global _launcher
    if _launcher:
        raise RuntimeError(_('serve() can only be called once'))

    _launcher = service.launch(CONF, server, workers=workers)
コード例 #58
0
ファイル: base.py プロジェクト: fabrickit/fabkit
def agent_central():
    server = CentralService()
    lancher = service.launch(CONF, server, workers=1)
    lancher.wait()
コード例 #59
0
ファイル: server.py プロジェクト: marcelarosalesj/x.stx-integ
def run_service():
    CONF(sys.argv[1:])
    logging.setup(CONF, "ceph-manager")
    launcher = service.launch(CONF, Service(CONF), workers=1)
    launcher.wait()
コード例 #60
0
def start():
    config.init(sys.argv[1:])
    config.setup_logging()
    clients.setup_clients()
    fuxik8s_launcher = service.launch(config.CONF, FuxiK8sService())
    fuxik8s_launcher.wait()