OpenStack Orchestration (Heat)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.6 KiB

#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Heat Engine Server.
This does the work of actually implementing the API calls made by the user.
Normal communications is done via the heat API which then calls into this
import eventlet
import sys
from oslo_concurrency import processutils
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
from oslo_service import service
from heat.common import config
from heat.common.i18n import _LC
from heat.common import messaging
from heat.common import profiler
from heat.engine import template
from heat.rpc import api as rpc_api
from heat import version
LOG = logging.getLogger('heat.engine')
def launch_engine(setup_logging=True):
if setup_logging:
cfg.CONF(project='heat', prog='heat-engine',
if setup_logging:
logging.setup(cfg.CONF, 'heat-engine')
mgr = None
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
srv = engine.EngineService(, 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
return launcher
def main():
launcher = launch_engine()