Enable strategy parameters
Strategy provides parameters to customize algorithm behavior. End user could query then specify parameters for their requirements. Change-Id: Id097db5f6e79c94b57674c8e5d55b06098abf18c Implements-bp: optimization-threshold
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
from oslo_log import log
|
||||
|
||||
from watcher.common import clients
|
||||
from watcher.common import utils
|
||||
from watcher.decision_engine.strategy.context import base
|
||||
from watcher.decision_engine.strategy.selection import default
|
||||
|
||||
@@ -58,4 +59,14 @@ class DefaultStrategyContext(base.BaseStrategyContext):
|
||||
|
||||
selected_strategy = strategy_selector.select()
|
||||
|
||||
schema = selected_strategy.get_schema()
|
||||
if not audit.parameters and schema:
|
||||
# Default value feedback if no predefined strategy
|
||||
utils.DefaultValidatingDraft4Validator(schema).validate(
|
||||
audit.parameters)
|
||||
|
||||
selected_strategy.input_parameters.update({
|
||||
name: value for name, value in audit.parameters.items()
|
||||
})
|
||||
|
||||
return selected_strategy.execute()
|
||||
|
||||
Reference in New Issue
Block a user