本文整理汇总了Python中stevedore.NamedExtensionManager方法的典型用法代码示例。如果您正苦于以下问题:Python stevedore.NamedExtensionManager方法的具体用法?Python stevedore.NamedExtensionManager怎么用?Python stevedore.NamedExtensionManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stevedore
的用法示例。
在下文中一共展示了stevedore.NamedExtensionManager方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import NamedExtensionManager [as 别名]
def __init__(self, *args, **kwargs):
super(Healthcheck, self).__init__(*args, **kwargs)
self.oslo_conf.register_opts(opts.HEALTHCHECK_OPTS,
group='healthcheck')
self._path = self._conf_get('path')
self._show_details = self._conf_get('detailed')
self._backends = stevedore.NamedExtensionManager(
self.NAMESPACE, self._conf_get('backends'),
name_order=True, invoke_on_load=True,
invoke_args=(self.oslo_conf, self.conf))
self._accept_to_functor = collections.OrderedDict([
# Order here matters...
('text/plain', self._make_text_response),
('text/html', self._make_html_response),
('application/json', self._make_json_response),
])
self._accept_order = tuple(self._accept_to_functor)
# When no accept type matches instead of returning 406 we will
# always return text/plain (because sending an error from this
# middleware actually can cause issues).
self._default_accept = 'text/plain'
self._ignore_path = False
示例2: processing_hooks_manager
# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import NamedExtensionManager [as 别名]
def processing_hooks_manager(*args):
"""Create a Stevedore extension manager for processing hooks.
:param args: arguments to pass to the hooks constructor.
"""
global _HOOKS_MGR
if _HOOKS_MGR is None:
names = [x.strip()
for x in CONF.processing.processing_hooks.split(',')
if x.strip()]
_HOOKS_MGR = stevedore.NamedExtensionManager(
'ironic_inspector.hooks.processing',
names=names,
invoke_on_load=True,
invoke_args=args,
on_missing_entrypoints_callback=missing_entrypoints_callback,
name_order=True)
return _HOOKS_MGR
示例3: load
# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import NamedExtensionManager [as 别名]
def load(self, *args, **kwargs):
mgr = stevedore.NamedExtensionManager(
'dragonflow.controller.apps',
self.apps_list,
invoke_on_load=True,
invoke_args=args,
invoke_kwds=kwargs,
)
for ext in mgr:
self.apps[ext.name] = ext.obj
示例4: _get_app_class
# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import NamedExtensionManager [as 别名]
def _get_app_class(self, app_type):
"""Get an application class (Python class) by app name"""
mgr = stevedore.NamedExtensionManager(
'dragonflow.controller.apps',
[app_type],
invoke_on_load=False,
)
for ext in mgr:
return ext.plugin
else:
raise RuntimeError(_('Failed to load app {0}').format(app_type))
示例5: threshold_evaluators
# 需要导入模块: import stevedore [as 别名]
# 或者: from stevedore import NamedExtensionManager [as 别名]
def threshold_evaluators(self):
if not self._threshold_evaluators:
threshold_types = ('ceilometer',
'gnocchi_resources_threshold',
'gnocchi_aggregation_by_metrics_threshold',
'gnocchi_aggregation_by_resources_threshold')
self._threshold_evaluators = stevedore.NamedExtensionManager(
'aodh.evaluator', threshold_types, invoke_on_load=True,
invoke_args=(self.conf,))
return self._threshold_evaluators