mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
This adds an additional check and corresponding error message to the validation of the model memory limit. If the parsing of the memory model limit results in 0 bytes the message will be triggered. This behaviour catches both correctly formatted but invalid strings (like 0mb) and invalid strings (like asdf).
This commit is contained in:
parent
e19a951594
commit
895249f1d9
3 changed files with 38 additions and 1 deletions
|
@ -192,4 +192,32 @@ describe('ML - validateModelMemoryLimit', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('Called with specified invalid mml of "0mb"', () => {
|
||||
const dtrs = createDetectors(1);
|
||||
const job = getJobConfig(['instance'], dtrs);
|
||||
const duration = { start: 0, end: 1 };
|
||||
job.analysis_limits.model_memory_limit = '0mb';
|
||||
|
||||
return validateModelMemoryLimit(callWithRequest, job, duration).then(
|
||||
(messages) => {
|
||||
const ids = messages.map(m => m.id);
|
||||
expect(ids).to.eql(['mml_value_invalid']);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('Called with specified invalid mml of "asdf"', () => {
|
||||
const dtrs = createDetectors(1);
|
||||
const job = getJobConfig(['instance'], dtrs);
|
||||
const duration = { start: 0, end: 1 };
|
||||
job.analysis_limits.model_memory_limit = 'asdf';
|
||||
|
||||
return validateModelMemoryLimit(callWithRequest, job, duration).then(
|
||||
(messages) => {
|
||||
const ids = messages.map(m => m.id);
|
||||
expect(ids).to.eql(['mml_value_invalid']);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -151,6 +151,10 @@
|
|||
"status": "ERROR",
|
||||
"text": "The model memory limit is greater than the max model memory limit configured for this cluster."
|
||||
},
|
||||
"mml_value_invalid": {
|
||||
"status": "ERROR",
|
||||
"text": "{{mml}} is not a valid value for model memory limit. The value should be specified in bytes e.g. 10MB"
|
||||
},
|
||||
"estimated_mml_greater_than_mml": {
|
||||
"status": "INFO",
|
||||
"text": "The estimated model memory limit is greater than the model memory limit you have configured."
|
||||
|
|
|
@ -96,7 +96,12 @@ export async function validateModelMemoryLimit(callWithRequest, job, duration) {
|
|||
// the max mml
|
||||
if (runEstimateGreaterThenMml && mml !== null) {
|
||||
const mmlBytes = numeral(mml).value();
|
||||
if (mmlEstimateBytes > mmlBytes) {
|
||||
if (mmlBytes === 0) {
|
||||
messages.push({
|
||||
id: 'mml_value_invalid',
|
||||
mml
|
||||
});
|
||||
} else if (mmlEstimateBytes > mmlBytes) {
|
||||
messages.push({
|
||||
id: 'estimated_mml_greater_than_mml',
|
||||
maxModelMemoryLimit,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue