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
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()