Coverage for watcher/decision_engine/planner/base.py: 100%
6 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#
4# Authors: Jean-Emile DARTOIS <jean-emile.dartois@b-com.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15# implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
20"""
21The :ref:`Watcher Planner <watcher_planner_definition>` is part of the
22:ref:`Watcher Decision Engine <watcher_decision_engine_definition>`.
24This module takes the set of :ref:`Actions <action_definition>` generated by a
25:ref:`Strategy <strategy_definition>` and builds the design of a workflow which
26defines how-to schedule in time those different
27:ref:`Actions <action_definition>` and for each
28:ref:`Action <action_definition>` what are the prerequisite conditions.
30It is important to schedule :ref:`Actions <action_definition>` in time in order
31to prevent overload of the :ref:`Cluster <cluster_definition>` while applying
32the :ref:`Action Plan <action_plan_definition>`. For example, it is important
33not to migrate too many instances at the same time in order to avoid a network
34congestion which may decrease the :ref:`SLA <sla_definition>` for
35:ref:`Customers <customer_definition>`.
37It is also important to schedule :ref:`Actions <action_definition>` in order to
38avoid security issues such as denial of service on core OpenStack services.
40:ref:`Some default implementations are provided <watcher_planners>`, but it is
41possible to :ref:`develop new implementations <implement_planner_plugin>`
42which are dynamically loaded by Watcher at launch time.
44See :doc:`../architecture` for more details on this component.
45"""
47import abc
49from watcher.common.loader import loadable
52class BasePlanner(loadable.Loadable, metaclass=abc.ABCMeta):
54 @classmethod
55 def get_config_opts(cls):
56 """Defines the configuration options to be associated to this loadable
58 :return: A list of configuration options relative to this Loadable
59 :rtype: list of :class:`oslo_config.cfg.Opt` instances
60 """
61 return []
63 @abc.abstractmethod
64 def schedule(self, context, audit_uuid, solution):
65 """The planner receives a solution to schedule
67 :param solution: A solution provided by a strategy for scheduling
68 :type solution: :py:class:`~.BaseSolution` subclass instance
69 :param audit_uuid: the audit uuid
70 :type audit_uuid: str
71 :return: Action plan with an ordered sequence of actions such that all
72 security, dependency, and performance requirements are met.
73 :rtype: :py:class:`watcher.objects.ActionPlan` instance
74 """
75 # example: directed acyclic graph
76 raise NotImplementedError()