def test_reset_pool_size_to_default(self): test_service = service.WSGIService("test_service") test_service.start() # Stopping the service, which in turn sets pool size to 0 test_service.stop() self.assertEqual(test_service.server._pool.size, 0) # Resetting pool size to default test_service.reset() test_service.start() self.assertEqual(test_service.server._pool.size, CONF.wsgi.default_pool_size)
def main(): api_config.parse_args(sys.argv) logging.setup(CONF, "masakari") log = logging.getLogger(__name__) objects.register_all() launcher = service.process_launcher() try: server = service.WSGIService("masakari_api", use_ssl=CONF.use_ssl) launcher.launch_service(server, workers=server.workers or 1) except exception.PasteAppNotFound as ex: log.error("Failed to start ``masakari_api`` service. Error: %s", str(ex)) sys.exit(1) launcher.wait()
def main(): api_config.parse_args(sys.argv) logging.setup(CONF, "masakari") log = logging.getLogger(__name__) objects.register_all() launcher = service.process_launcher() started = 0 try: server = service.WSGIService("masakari_api", use_ssl=CONF.use_ssl) launcher.launch_service(server, workers=server.workers or 1) started += 1 except exception.PasteAppNotFound as ex: log.warning( "%s. ``enabled_apis`` includes bad values. " "Fix to remove this warning.", six.text_type(ex)) if started == 0: log.error('No APIs were started. ' 'Check the enabled_apis config option.') sys.exit(1) launcher.wait()
def test_workers_set_zero_user_setting(self): CONF.set_override('masakari_api_workers', 0) test_service = service.WSGIService("masakari_api") # If a value less than 1 is used, defaults to number of procs available self.assertEqual(test_service.workers, processutils.get_worker_count())
def test_workers_set_good_user_setting(self): CONF.set_override('masakari_api_workers', 8) test_service = service.WSGIService("masakari_api") self.assertEqual(test_service.workers, 8)
def test_workers_set_default(self): test_service = service.WSGIService("masakari_api") self.assertEqual(test_service.workers, processutils.get_worker_count())