[ML] MML calculator enhancements for multi-metric job wizard (#54573)

* [ML] fix fieldNames provided to calculateModelMemoryLimit

* [ML] calculateModelMemoryLimit when the influencers are changed
This commit is contained in:
Dima Arnautov 2020-01-14 08:58:43 +01:00 committed by GitHub
parent 7c4a531ae7
commit 9a871d2a7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -92,12 +92,11 @@ export class MultiMetricJobCreator extends JobCreator {
// not split field, use the default
this.modelMemoryLimit = DEFAULT_MODEL_MEMORY_LIMIT;
} else {
const fieldNames = this._detectors.map(d => d.field_name).filter(fn => fn !== undefined);
const { modelMemoryLimit } = await ml.calculateModelMemoryLimit({
indexPattern: this._indexPatternTitle,
splitFieldName: this._splitField.name,
query: this._datafeed_config.query,
fieldNames,
fieldNames: this.fields.map(f => f.id),
influencerNames: this._influencers,
timeFieldName: this._job_config.data_description.time_field,
earliestMs: this._start,

View file

@ -25,6 +25,9 @@ export const Influencers: FC = () => {
useEffect(() => {
jobCreator.removeAllInfluencers();
influencers.forEach(i => jobCreator.addInfluencer(i));
if (jobCreator instanceof MultiMetricJobCreator) {
jobCreator.calculateModelMemoryLimit();
}
jobCreatorUpdate();
}, [influencers.join()]);