diff --git a/aodh/evaluator/__init__.py b/aodh/evaluator/__init__.py index 35e47175e..a18719bec 100644 --- a/aodh/evaluator/__init__.py +++ b/aodh/evaluator/__init__.py @@ -215,8 +215,10 @@ class AlarmEvaluationService(cotyledon.Service): # allow time for coordination if necessary delay_start = self.partition_coordinator.is_active() + evaluation_interval = self.conf.evaluator.evaluation_interval + if self.evaluators: - @periodics.periodic(spacing=self.conf.evaluation_interval, + @periodics.periodic(spacing=evaluation_interval, run_immediately=not delay_start) def evaluate_alarms(): self._evaluate_assigned_alarms() @@ -225,7 +227,7 @@ class AlarmEvaluationService(cotyledon.Service): if self.partition_coordinator.is_active(): heartbeat_interval = min(self.conf.coordination.heartbeat_interval, - self.conf.evaluation_interval / 4) + evaluation_interval / 4) @periodics.periodic(spacing=heartbeat_interval, run_immediately=True) @@ -288,7 +290,7 @@ class AlarmEvaluationService(cotyledon.Service): def _assigned_alarms(self): before = (timeutils.utcnow() - datetime.timedelta( - seconds=self.conf.evaluation_interval / 2)) + seconds=self.conf.evaluator.evaluation_interval / 2)) selected = self.storage_conn.get_alarms( enabled=True, type={'ne': 'event'}, diff --git a/aodh/service.py b/aodh/service.py index f785d8e5c..26b9838c9 100644 --- a/aodh/service.py +++ b/aodh/service.py @@ -41,11 +41,6 @@ OPTS = [ 'effect.'), help='Timeout seconds for HTTP requests. Set it to None to ' 'disable timeout.'), - cfg.IntOpt('evaluation_interval', - default=60, - help='Period of evaluation cycle, should' - ' be >= than configured pipeline interval for' - ' collection of underlying meters.'), ] EVALUATOR_OPTS = [ @@ -53,7 +48,13 @@ EVALUATOR_OPTS = [ default=1, min=1, help='Number of workers for evaluator service. ' - 'default value is 1.') + 'default value is 1.'), + cfg.IntOpt('evaluation_interval', + default=60, + deprecated_group='DEFAULT', + help='Period of evaluation cycle, should' + ' be >= than configured pipeline interval for' + ' collection of underlying meters.'), ] NOTIFIER_OPTS = [ diff --git a/aodh/tests/unit/test_evaluator.py b/aodh/tests/unit/test_evaluator.py index 47eb34a97..f8deea9a3 100644 --- a/aodh/tests/unit/test_evaluator.py +++ b/aodh/tests/unit/test_evaluator.py @@ -66,7 +66,8 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase): coordination_active=False): self.CONF.set_override('evaluation_interval', - test_interval) + test_interval, + group='evaluator') self.CONF.set_override('heartbeat_interval', coordination_heartbeat_interval, group='coordination') diff --git a/releasenotes/notes/migrate-evaluation_interval-c65ba5cbe5fabb35.yaml b/releasenotes/notes/migrate-evaluation_interval-c65ba5cbe5fabb35.yaml new file mode 100644 index 000000000..2006c62de --- /dev/null +++ b/releasenotes/notes/migrate-evaluation_interval-c65ba5cbe5fabb35.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The ``[DEFAULT] evaluation_interval`` parameter has been migrated to + the ``[evaluator]`` section. The old parameter is still kept for backword + compatibility but will be removed in a future release.