def main(): service.prepare_service(sys.argv) gmr.TextGuruMeditation.setup_autorun(version) # Enable object backporting via the conductor base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI() app = api_app.load_app() # Setup OSprofiler for WSGI service profiler.setup('magnum-api', CONF.host) # SSL configuration use_ssl = CONF.api.enabled_ssl # Create the WSGI server and start it host, port = CONF.api.host, CONF.api.port LOG.info(_LI('Starting server in PID %s'), os.getpid()) LOG.debug("Configuration:") CONF.log_opt_values(LOG, logging.DEBUG) LOG.info(_LI('Serving on %(proto)s://%(host)s:%(port)s'), dict(proto="https" if use_ssl else "http", host=host, port=port)) serving.run_simple(host, port, app, ssl_context=_get_ssl_configs(use_ssl))
def main(): service.prepare_service(sys.argv) gmr.TextGuruMeditation.setup_autorun(version) # Enable object backporting via the conductor base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI() app = api_app.load_app() # Setup OSprofiler for WSGI service profiler.setup('magnum-api', CONF.host) # SSL configuration use_ssl = CONF.api.enabled_ssl # Create the WSGI server and start it host, port = CONF.api.host, CONF.api.port LOG.info('Starting server in PID %s' % os.getpid()) LOG.debug("Configuration:") CONF.log_opt_values(LOG, logging.DEBUG) LOG.info('Serving on %(proto)s://%(host)s:%(port)s' % dict(proto="https" if use_ssl else "http", host=host, port=port)) workers = CONF.api.workers if not workers: workers = processutils.get_worker_count() LOG.info('Server will handle each request in a new process up to' ' %s concurrent processes' % workers) serving.run_simple(host, port, app, processes=workers, ssl_context=_get_ssl_configs(use_ssl))
def main(): service.prepare_service(sys.argv) gmr.TextGuruMeditation.setup_autorun(version) # Enable object backporting via the conductor base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI() app = api_app.load_app() # Setup OSprofiler for WSGI service profiler.setup('magnum-api', CONF.host) # SSL configuration use_ssl = CONF.api.enabled_ssl # Create the WSGI server and start it host, port = CONF.api.host, CONF.api.port LOG.info(_LI('Starting server in PID %s'), os.getpid()) LOG.debug("Configuration:") CONF.log_opt_values(LOG, logging.DEBUG) LOG.info(_LI('Serving on %(proto)s://%(host)s:%(port)s'), dict(proto="https" if use_ssl else "http", host=host, port=port)) workers = CONF.api.workers if not workers: workers = processutils.get_worker_count() LOG.info(_LI('Server will handle each request in a new process up to' ' %s concurrent processes'), workers) serving.run_simple(host, port, app, processes=workers, ssl_context=_get_ssl_configs(use_ssl))
def test_setup_profiler(self, mock_init): self.config(enabled=True, group='profiler') profiler.setup('foo', 'localhost') mock_init.assert_called_once_with(conf=conf.CONF, context=mock.ANY, project="magnum", service='foo', host='localhost')
def __init__(self, topic, server, handlers, binary): super(Service, self).__init__() # TODO(asalkeld) add support for version='x.y' target = messaging.Target(topic=topic, server=server) self._server = rpc.get_server( target, handlers, serializer=objects_base.MagnumObjectSerializer() ) self.binary = binary profiler.setup(binary, CONF.host)
def __init__(self, topic, server, handlers, binary): super(Service, self).__init__() serializer = _init_serializer() transport = messaging.get_transport(CONF) # TODO(asalkeld) add support for version='x.y' target = messaging.Target(topic=topic, server=server) self._server = messaging.get_rpc_server(transport, target, handlers, serializer=serializer) self.binary = binary profiler.setup(binary, CONF.host)
def __init__(self, topic, server, handlers, binary): super(Service, self).__init__() serializer = _init_serializer() transport = messaging.get_rpc_transport(CONF) # TODO(asalkeld) add support for version='x.y' access_policy = dispatcher.DefaultRPCAccessPolicy target = messaging.Target(topic=topic, server=server) self._server = messaging.get_rpc_server(transport, target, handlers, executor='eventlet', serializer=serializer, access_policy=access_policy) self.binary = binary profiler.setup(binary, CONF.host)
def test_setup_profiler_without_osprofiler(self, mock_init): profiler.setup('foo', 'localhost') self.assertEqual(False, mock_init.called)