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

[ML] DF Analytics - auto-populate model_memory_limit #50714

Merged

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Nov 14, 2019

Summary

Fix for #43740 (Improve UX regarding df analytics model memory limit)

Auto-populates model_memory_limit field using ml/data_frame/analytics/_estimate_memory_usage endpoint.

validateModelMemoryLimitUnits has been updated to be be more generic. cc @jgowdyelastic

Validates that mml is not empty and has valid content in both the advanced editor:

image

and the form:

image

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@alvarezmelissa87 alvarezmelissa87 changed the title Ml regression config mmlimit [ML] DF Analytics - auto-populate model_memory_limit Nov 14, 2019
@alvarezmelissa87 alvarezmelissa87 mentioned this pull request Nov 14, 2019
46 tasks
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alvarezmelissa87
Copy link
Contributor Author

cc @droberts195

Comment on lines +114 to +117
const jobConfig = getJobConfigFromFormState(form);
delete jobConfig.dest;
Copy link
Contributor

Choose a reason for hiding this comment

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

it can be const { dest, ...jobConfig} = getJobConfigFromFormState(form);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for taking a look! 😄
I think that's a good option if mutability is a concern, but in this case jobConfig isn't relied on for anything else. I think in this case I prefer clarity of semantics and functionality by explicitly using delete.
Unless I'm missing some other benefit that this has over using delete 🤔
cc @darnautov

@@ -69,6 +69,7 @@ declare interface Ml {
getDataFrameAnalyticsStats(analyticsId?: string): Promise<GetDataFrameAnalyticsStatsResponse>;
createDataFrameAnalytics(analyticsId: string, analyticsConfig: any): Promise<any>;
evaluateDataFrameAnalytics(evaluateConfig: any): Promise<any>;
estimateMemoryUsage(jobConfig: any): Promise<any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please provide types here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added type: b63f93e

@@ -170,6 +170,16 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
method: 'POST'
});

ml.estimateMemoryUsage = ca({
Copy link
Contributor

Choose a reason for hiding this comment

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

I think DataFrameAnalytics should be in the function name here. More verbose, but otherwise it isn't clear that is can't be used to estimate the MML for anomaly detection jobs for example. estimateDataFrameAnalyticsMemoryUsage !?

@@ -69,6 +69,7 @@ declare interface Ml {
getDataFrameAnalyticsStats(analyticsId?: string): Promise<GetDataFrameAnalyticsStatsResponse>;
createDataFrameAnalytics(analyticsId: string, analyticsConfig: any): Promise<any>;
evaluateDataFrameAnalytics(evaluateConfig: any): Promise<any>;
estimateMemoryUsage(jobConfig: any): Promise<any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed below, I think DataFrameAnalytics needs to be in the function name here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to include DataFrameAnalytics in the function name: b63f93e

defaultMessage: 'Model memory limit',
})}
>
<EuiFieldText
Copy link
Contributor

Choose a reason for hiding this comment

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

Could the default value (or the one from the endpoint) be used as a placeholder?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Placeholder added: f8c50cf

export enum DEFAULT_MODEL_MEMORY_LIMIT {
regression = '100mb',
// eslint-disable-next-line @typescript-eslint/camelcase
outlier_detection = '50mb',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used? When I start in the wizard, and set the type to Outlier detection, the default stays at 100mb.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is used as the default value placeholder for when jobType is outlier detection.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Code LGTM! Would be good to add some tests to reducer.test.ts since we already have that in place to write tests against it.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest edits and LGTM

@alvarezmelissa87
Copy link
Contributor Author

Good call @walterra 🙌 Added tests in 94598c4
Would you be up for taking a quick look when you get a chance? Thanks! 😄

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

LGTM!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alvarezmelissa87 alvarezmelissa87 merged commit dd06bfc into elastic:master Nov 18, 2019
@alvarezmelissa87 alvarezmelissa87 deleted the ml-regression-config-mmlimit branch November 18, 2019 18:23
alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request Nov 18, 2019
* create modelMemoryLimit estimation endpoint. add value to form

* add validation for model memory limit field

* update jest tests

* update validateModelMemoryLimitUnitsUtils to be more generic

* add placeholder and validation with helpText to modelMemoryLimit field

* update endpoint name to estimateDataFrameAnalyticsMemoryUsage for clarity

* tweak modelMemoryLimitEmpty check in reducer

* add tests for modelMemoryLimit validation
alvarezmelissa87 added a commit that referenced this pull request Nov 18, 2019
* create modelMemoryLimit estimation endpoint. add value to form

* add validation for model memory limit field

* update jest tests

* update validateModelMemoryLimitUnitsUtils to be more generic

* add placeholder and validation with helpText to modelMemoryLimit field

* update endpoint name to estimateDataFrameAnalyticsMemoryUsage for clarity

* tweak modelMemoryLimitEmpty check in reducer

* add tests for modelMemoryLimit validation
jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 18, 2019
…-fallback

* 'master' of github.com:elastic/kibana: (116 commits)
  [Maps] move apply global filter settting from layer to source (elastic#50523)
  [SIEM] Fix: Empty `Source` / `Destination` shown when only ports are populated (elastic#50843)
  [Maps] Delay vector tile layer syncing until spritesheet is loaded (elastic#48955)
  [Maps] prevent users from overflowing URL when filtering by shape (elastic#50747)
  [DOCS] Mark Beats central management as discontinued (elastic#49423)
  [page_objects/common_page] convert to ts (elastic#50771)
  [NP Kibana Migrations ] kibana plugin home (elastic#50444)
  [DOCS] Shareables naming convention (elastic#50497)
  [ML] DF Analytics - auto-populate model_memory_limit (elastic#50714)
  Increase alerting test stability and reduce flakiness (elastic#50246)
  [ML] Remaning new_job_new folder (elastic#50917)
  [Telemetry] Show opt-in changes for OSS users (elastic#50831)
  [ML] Fix lat_long anomalies table links menu and value formatting (elastic#50916)
  [Dev] Fix serialising a really big string (elastic#50915)
  Better explanation about the Prettier recommendation (extension vs. NPM module) (elastic#50629)
  [Monitoring] Use a basic monitoring user for tests (elastic#47865)
  [Monitoring] Gracefully handle issue with filebeat indices (elastic#48929)
  [Monitoring] Improve permissions required around setup mode (elastic#50421)
  Additional validation for elasticsearch username (elastic#48247)
  Revert changes to use_kibana_ui_setting (elastic#50877)
  ...

# Conflicts:
#	src/legacy/core_plugins/console/server/request.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants