Skip to content
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

Enables vpa demo to pick up custom term and model #1494

Open
wants to merge 20 commits into
base: mvp_demo
Choose a base branch
from

Conversation

bhanvimenghani
Copy link
Contributor

Description

This pr makes changes in the vpa updater to enable it to pick up term and model set by the user, removing the hard coding done earlier for short and performance.
This pr is on top of #1457 pr and needs that to be merged before merging this one

Fixes # (issue)

Type of change

  • Bug fix
  • New feature
  • Docs update
  • Breaking change (What changes might users need to make in their application due to this PR?)
  • Requires DB changes

How has this been tested?

Please describe the tests that were run to verify your changes and steps to reproduce. Please specify any test configuration required.

  • New Test X
  • Functional testsuite

Test Configuration

  • Kubernetes clusters tested on:

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

Include any additional information such as links, test results, screenshots here

@bhanvimenghani bhanvimenghani added this to the Kruize 0.4 Release milestone Feb 10, 2025
@bhanvimenghani bhanvimenghani self-assigned this Feb 10, 2025
for a single model and a single term. Model can be set to either cost or performance and
term can be set to short, medium or long term.

If mode is set to auto or recreate and the above settings are not mentioned then it will
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bhanvimenghani Can you please add - If mode is one of auto / recreate, then there can only be one term and one model chosen.

// common check for terms and models
if (expObj.getRecommendation_settings().getTermSettings() != null &&
expObj.getRecommendation_settings().getTermSettings().getTerms() != null ) {
Set<String> validTerms = Set.of("short", "medium", "long");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use constants defined AnalyzerConstants.RecommendationSettings.LONG_TERM


if (expObj.getRecommendation_settings().getModelSettings() != null &&
expObj.getRecommendation_settings().getModelSettings().getModels() != null) {
Set<String> validModels = Set.of("cost", "performance");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, please use constants.

public static void setDefaultTerms(Map<String, Terms> terms, KruizeObject kruizeObject) {
// TODO: define term names like daily, weekly, fortnightly etc
// TODO: add CRD for terms
// for monitoring use case
terms.put(KruizeConstants.JSONKeys.SHORT_TERM, new Terms(KruizeConstants.JSONKeys.SHORT_TERM,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting hard coded values, we need to calculate threshold value according to measurement_duration.

terms.put(KruizeConstants.JSONKeys.SHORT_TERM, new Terms(KruizeConstants.JSONKeys.SHORT_TERM,
                KruizeConstants.RecommendationEngineConstants.DurationBasedEngine.DurationAmount.SHORT_TERM_DURATION_DAYS,
                getTermThresholdInDays(KruizeConstants.JSONKeys.SHORT_TERM, kruizeObject.getTrial_settings().getMeasurement_durationMinutes_inDouble()),
                4, 0.25));

For getTermThresholdInDays function details, please check here - https://github.com/kruize/autotune/pull/1466/files#diff-5c812482acaccb6f20150f52c889033372cdd32312bb75c76e32e25a3ac2b3baR366-R367


for (String userInputTerm : termList) {
if (AnalyzerConstants.RecommendationSettings.SHORT.equalsIgnoreCase(userInputTerm)) {
terms.put(KruizeConstants.JSONKeys.SHORT_TERM, new Terms(KruizeConstants.JSONKeys.SHORT_TERM,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, for custom terms also instead of setting hard coded values, we need to calculate threshold value according to measurement_duration.

// Add new models
recommendationModels = new ArrayList<>();
for (String model : modelName) {
if ("cost".equalsIgnoreCase(model)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace these values with constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

3 participants