Coverage for watcher/decision_engine/manager.py: 100%
32 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# -*- encoding: utf-8 -*-
2# Copyright (c) 2015 b<>com
3# Copyright (c) 2016 Intel Corp
4#
5# Authors: Jean-Emile DARTOIS <jean-emile.dartois@b-com.com>
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16# implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
20"""
21This component is responsible for computing a set of potential optimization
22:ref:`Actions <action_definition>` in order to fulfill the
23:ref:`Goal <goal_definition>` of an :ref:`Audit <audit_definition>`.
25It first reads the parameters of the :ref:`Audit <audit_definition>` from the
26associated :ref:`Audit Template <audit_template_definition>` and knows the
27:ref:`Goal <goal_definition>` to achieve.
29It then selects the most appropriate :ref:`Strategy <strategy_definition>`
30depending on how Watcher was configured for this :ref:`Goal <goal_definition>`.
32The :ref:`Strategy <strategy_definition>` is then executed and generates a set
33of :ref:`Actions <action_definition>` which are scheduled in time by the
34:ref:`Watcher Planner <watcher_planner_definition>` (i.e., it generates an
35:ref:`Action Plan <action_plan_definition>`).
37See :doc:`../architecture` for more details on this component.
38"""
40from watcher.common import service_manager
41from watcher import conf
42from watcher.decision_engine.messaging import audit_endpoint
43from watcher.decision_engine.messaging import data_model_endpoint
44from watcher.decision_engine.model.collector import manager
45from watcher.decision_engine.strategy.strategies import base \
46 as strategy_endpoint
48CONF = conf.CONF
51class DecisionEngineManager(service_manager.ServiceManager):
53 @property
54 def service_name(self):
55 return 'watcher-decision-engine'
57 @property
58 def api_version(self):
59 return '1.0'
61 @property
62 def publisher_id(self):
63 return CONF.watcher_decision_engine.publisher_id
65 @property
66 def conductor_topic(self):
67 return CONF.watcher_decision_engine.conductor_topic
69 @property
70 def notification_topics(self):
71 return CONF.watcher_decision_engine.notification_topics
73 @property
74 def conductor_endpoints(self):
75 return [audit_endpoint.AuditEndpoint,
76 strategy_endpoint.StrategyEndpoint,
77 data_model_endpoint.DataModelEndpoint]
79 @property
80 def notification_endpoints(self):
81 return self.collector_manager.get_notification_endpoints()
83 @property
84 def collector_manager(self):
85 return manager.CollectorManager()