adb2121795
Downstream test environments are frequently having failing stacks with error messages like: MessagingTimeout: resources[0]: Timed out waiting for a reply to message ID ... These environments generally have 1 or 2 cores, so only spawn one or two engine workers. This deadlocks with stacks that have many nested stacks due to engine->engine RPC calls. Even our own functional tests don't work reliably with less than 4 workers, and the workaround has been to set that explicitly in pre_test_hook.sh. This change sets the default minimum number of workers to 4, but still matches workers to cores for larger servers. This change also moves the default evaluation to heat.cmd.engine so that generated configuration doesn't get a inappropriate default value. Change-Id: Iae6b3956bad414406d901bb2213c9ec230ff4304 Closes-Bug: #1526045
80 lines
2.5 KiB
Python
80 lines
2.5 KiB
Python
#!/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
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# 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
|
|
engine.
|
|
"""
|
|
|
|
import eventlet
|
|
eventlet.monkey_patch()
|
|
|
|
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
|
|
|
|
i18n.enable_lazy()
|
|
|
|
LOG = logging.getLogger('heat.engine')
|
|
|
|
|
|
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()
|