Merge "Don't need a metaclass for AlarmEvaluationService"
This commit is contained in:
commit
ff5fc2c9e3
@ -179,15 +179,18 @@ class Evaluator(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class AlarmEvaluationService(os_service.Service):
|
||||||
class AlarmService(object):
|
|
||||||
|
PARTITIONING_GROUP_NAME = "alarm_evaluator"
|
||||||
EVALUATOR_EXTENSIONS_NAMESPACE = "aodh.evaluator"
|
EVALUATOR_EXTENSIONS_NAMESPACE = "aodh.evaluator"
|
||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
super(AlarmService, self).__init__()
|
super(AlarmEvaluationService, self).__init__()
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
self.storage_conn = None
|
self.storage_conn = None
|
||||||
self._load_evaluators()
|
self._load_evaluators()
|
||||||
|
self.partition_coordinator = coordination.PartitionCoordinator(
|
||||||
|
conf.coordination.backend_url)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _storage_conn(self):
|
def _storage_conn(self):
|
||||||
@ -224,23 +227,8 @@ class AlarmService(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_('Failed to evaluate alarm %s'), alarm.alarm_id)
|
LOG.exception(_('Failed to evaluate alarm %s'), alarm.alarm_id)
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def _assigned_alarms(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class AlarmEvaluationService(AlarmService, os_service.Service):
|
|
||||||
|
|
||||||
PARTITIONING_GROUP_NAME = "alarm_evaluator"
|
|
||||||
|
|
||||||
def __init__(self, conf):
|
|
||||||
super(AlarmEvaluationService, self).__init__(conf)
|
|
||||||
self.partition_coordinator = coordination.PartitionCoordinator(
|
|
||||||
conf.coordination.backend_url)
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
super(AlarmEvaluationService, self).start()
|
super(AlarmEvaluationService, self).start()
|
||||||
self.storage_conn = storage.get_connection_from_config(self.conf)
|
|
||||||
self.partition_coordinator.start()
|
self.partition_coordinator.start()
|
||||||
self.partition_coordinator.join_group(self.PARTITIONING_GROUP_NAME)
|
self.partition_coordinator.join_group(self.PARTITIONING_GROUP_NAME)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Tests for aodh.service.SingletonAlarmService.
|
"""Tests for aodh.evaluator.AlarmEvaluationService.
|
||||||
"""
|
"""
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import fixture as fixture_config
|
from oslo_config import fixture as fixture_config
|
||||||
|
Loading…
Reference in New Issue
Block a user