in r8s/r8s_group/algorithm.py [0:0]
def update_recommendation_settings(algorithm_name, record_step_minutes,
threshold,
min_allowed_days, max_days,
min_allowed_days_schedule, ignore_savings,
max_recommended_shapes,
shape_compatibility_rule,
shape_sorting, use_past_recommendations,
use_instance_tags, analysis_price,
ignore_action,
target_timezone_name,discard_initial_zeros,
forbid_change_series, forbid_change_family):
"""
Updates a R8s algorithm recommendation settings.
"""
from r8s_service.initializer import init_configuration
thresholds = cast_to_list(threshold)
if thresholds and not len(thresholds) == 3:
response = {'message': "Exactly 3 threshold values required"}
return LocalCommandResponse(body=response)
ignore_actions = cast_to_list(ignore_action)
optional_parameters = (record_step_minutes, thresholds,
min_allowed_days, max_days,
min_allowed_days_schedule, ignore_savings,
max_recommended_shapes, shape_compatibility_rule,
shape_sorting, use_past_recommendations,
use_instance_tags, analysis_price, ignore_actions,
target_timezone_name, discard_initial_zeros,
forbid_change_series, forbid_change_family)
if not any(parameter_not_specified(param) for param
in optional_parameters):
response = {'message': "At least one of the optional "
"parameters must be specified"}
return LocalCommandResponse(body=response)
return init_configuration().algorithm_patch_recommendation_settings(
algorithm_name=algorithm_name,
record_step_minutes=record_step_minutes,
thresholds=thresholds,
min_allowed_days=min_allowed_days,
max_days=max_days,
min_allowed_days_schedule=min_allowed_days_schedule,
ignore_savings=ignore_savings,
max_recommended_shapes=max_recommended_shapes,
shape_compatibility_rule=shape_compatibility_rule,
shape_sorting=shape_sorting,
use_past_recommendations=use_past_recommendations,
use_instance_tags=use_instance_tags,
analysis_price=analysis_price,
ignore_actions=ignore_actions,
target_timezone_name=target_timezone_name,
discard_initial_zeros=discard_initial_zeros,
forbid_change_series=forbid_change_series,
forbid_change_family=forbid_change_family
)