mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Only set the estimated model memory limit if certain conditions apply. (#27670)
When cloning a job, the multi metric wizard would re-estimate the model memory limit and overwrite a possible customized limit. This PR fixes it by only setting the estimated limit when certain conditions apply: It only gets set to the estimation if the current limit is either the default value or the value of the previous estimation. That's our best guess if the value hasn't been customized. The check doesn't get it if the user intentionally for whatever reason (re)set the value to either the default or pervious estimate.
This commit is contained in:
parent
0923a469f1
commit
a2ab3ba756
1 changed files with 25 additions and 2 deletions
|
@ -639,6 +639,7 @@ module
|
|||
moveToAdvancedJobCreation(job);
|
||||
};
|
||||
|
||||
let lastEstimatedModelMemoryLimit = null;
|
||||
$scope.setModelMemoryLimit = function () {
|
||||
const formConfig = $scope.formConfig;
|
||||
ml.calculateModelMemoryLimit({
|
||||
|
@ -652,10 +653,32 @@ module
|
|||
latestMs: formConfig.end
|
||||
})
|
||||
.then((resp) => {
|
||||
formConfig.modelMemoryLimit = resp.modelMemoryLimit;
|
||||
// To avoid overwriting a possible custom set model memory limit,
|
||||
// it only gets set to the estimation if the current limit is either
|
||||
// the default value or the value of the previous estimation.
|
||||
// That's our best guess if the value hasn't been customized.
|
||||
// It doesn't get it if the user intentionally for whatever reason (re)set
|
||||
// the value to either the default or pervious estimate.
|
||||
// Because the string based limit could contain e.g. MB/Mb/mb
|
||||
// all strings get lower cased for comparison.
|
||||
const currentModelMemoryLimit = formConfig.modelMemoryLimit.toLowerCase();
|
||||
const defaultModelMemoryLimit = DEFAULT_MODEL_MEMORY_LIMIT.toLowerCase();
|
||||
if (
|
||||
currentModelMemoryLimit === defaultModelMemoryLimit ||
|
||||
currentModelMemoryLimit === lastEstimatedModelMemoryLimit
|
||||
) {
|
||||
formConfig.modelMemoryLimit = resp.modelMemoryLimit;
|
||||
}
|
||||
lastEstimatedModelMemoryLimit = resp.modelMemoryLimit.toLowerCase();
|
||||
})
|
||||
.catch(() => {
|
||||
formConfig.modelMemoryLimit = DEFAULT_MODEL_MEMORY_LIMIT;
|
||||
// To avoid overwriting a possible custom set model memory limit,
|
||||
// the limit is reset to the default only if the current limit matches
|
||||
// the previous estimated limit.
|
||||
const currentModelMemoryLimit = formConfig.modelMemoryLimit.toLowerCase();
|
||||
if (currentModelMemoryLimit === lastEstimatedModelMemoryLimit) {
|
||||
formConfig.modelMemoryLimit = DEFAULT_MODEL_MEMORY_LIMIT;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue