-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for setting lower/upper-bounds for autotuned resources #3744
Conversation
At the moment this only supports a specific subset of top-level resource keys: * cpus * mem * disk Supporting {min,max}_instances should be pretty trivial (but I'm not quite sure when we'd want to use that yet, so I left those out of the allowlist). I'm explicitly not supporting these values for sidecars since: a) it seemed like it would complicate things a bit and, b) I'm not sure we have a usecase for this :p
e1d8c9f
to
aad1ce9
Compare
@@ -276,7 +279,7 @@ def get_recommendations_by_service_file( | |||
result["cluster"], | |||
) # e.g. (foo, marathon-norcal-stagef) | |||
instance_type = result["cluster"].split("-", 1)[0] | |||
rec: Union[KubernetesRecommendation, CassandraRecommendation] | |||
rec: Union[KubernetesRecommendation, CassandraRecommendation] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not super necessary, but pyright was correctly calling this out as a potentially unbound variable below (and I figured this is innocuous enough to sneak in here :p)
paasta_tools/config_utils.py
Outdated
for limit_type, limits in ( | ||
existing_configs[instance_name].get("autotune_limits", {}).items() | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move this whole for loop into its own function, maybe called clamp_recommendations
? This function is a bit long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our first test for autotuned defaults logic!???
* Add docstring explaining types * Match return type * Update a test to make sure that we're doing the right thing with multiple instances in the same file
At the moment this only supports a specific subset of top-level resource keys:
Supporting {min,max}_instances should be pretty trivial (but I'm not quite sure when we'd want to use that yet, so I left those out of the allowlist).
I'm explicitly not supporting these values for sidecars since: a) it seemed like it would complicate things a bit and, b) I'm not sure we have a usecase for this :p