Coverage for watcher/decision_engine/goal/base.py: 100%
11 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) 2016 b<>com
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
17import abc
19from watcher.common.loader import loadable
22class Goal(loadable.Loadable, metaclass=abc.ABCMeta):
24 def __init__(self, config):
25 super(Goal, self).__init__(config)
26 self.name = self.get_name()
27 self.display_name = self.get_display_name()
28 self.efficacy_specification = self.get_efficacy_specification()
30 @classmethod
31 @abc.abstractmethod
32 def get_name(cls):
33 """Name of the goal: should be identical to the related entry point"""
34 raise NotImplementedError()
36 @classmethod
37 @abc.abstractmethod
38 def get_display_name(cls):
39 """The goal display name for the goal"""
40 raise NotImplementedError()
42 @classmethod
43 @abc.abstractmethod
44 def get_translatable_display_name(cls):
45 """The translatable msgid of the goal"""
46 # Note(v-francoise): Defined here to be used as the translation key for
47 # other services
48 raise NotImplementedError()
50 @classmethod
51 def get_config_opts(cls):
52 """Defines the configuration options to be associated to this loadable
54 :return: A list of configuration options relative to this Loadable
55 :rtype: list of :class:`oslo_config.cfg.Opt` instances
56 """
57 return []
59 @abc.abstractmethod
60 def get_efficacy_specification(cls):
61 """The efficacy spec for the current goal"""
62 raise NotImplementedError()