[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:
Walter Rafelsberger 2018-12-21 16:29:38 +01:00 committed by GitHub
parent 0923a469f1
commit a2ab3ba756
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}
});
};