Skip to content

Commit

Permalink
[ML] Fixing cloning of anomaly detection job with sparse data (#88322) (
Browse files Browse the repository at this point in the history
#88439)

* [ML] Fixing cloming of anomaly detection job with sparse data

* removing from population wizard
  • Loading branch information
jgowdyelastic authored Jan 15, 2021
1 parent 25c0810 commit 8a71415
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
CREATED_BY_LABEL,
SHARED_RESULTS_INDEX_NAME,
} from '../../../../../../common/constants/new_job';
import { isSparseDataJob, collectAggs } from './util/general';
import { collectAggs } from './util/general';
import { parseInterval } from '../../../../../../common/util/parse_interval';
import { Calendar } from '../../../../../../common/types/calendars';
import { mlCalendarService } from '../../../../services/calendar_service';
Expand Down Expand Up @@ -681,7 +681,6 @@ export class JobCreator {
) {
this.useDedicatedIndex = true;
}
this._sparseData = isSparseDataJob(job, datafeed);

this._scriptFields = [];
if (this._datafeed_config.script_fields !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { createBasicDetector } from './util/default_configs';
import { JOB_TYPE, CREATED_BY_LABEL } from '../../../../../../common/constants/new_job';
import { getRichDetectors } from './util/general';
import { IndexPattern } from '../../../../../../../../../src/plugins/data/public';
import { isSparseDataJob } from './util/general';

export class MultiMetricJobCreator extends JobCreator {
// a multi-metric job has one optional overall partition field
Expand Down Expand Up @@ -92,6 +93,7 @@ export class MultiMetricJobCreator extends JobCreator {
public cloneFromExistingJob(job: Job, datafeed: Datafeed) {
this._overrideConfigs(job, datafeed);
this.createdBy = CREATED_BY_LABEL.MULTI_METRIC;
this._sparseData = isSparseDataJob(job, datafeed);
const detectors = getRichDetectors(job, datafeed, this.additionalFields, false);

if (datafeed.aggregations !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { JOB_TYPE, CREATED_BY_LABEL } from '../../../../../../common/constants/new_job';
import { getRichDetectors } from './util/general';
import { IndexPattern } from '../../../../../../../../../src/plugins/data/public';
import { isSparseDataJob } from './util/general';

export class SingleMetricJobCreator extends JobCreator {
protected _type: JOB_TYPE = JOB_TYPE.SINGLE_METRIC;
Expand Down Expand Up @@ -196,6 +197,7 @@ export class SingleMetricJobCreator extends JobCreator {
public cloneFromExistingJob(job: Job, datafeed: Datafeed) {
this._overrideConfigs(job, datafeed);
this.createdBy = CREATED_BY_LABEL.SINGLE_METRIC;
this._sparseData = isSparseDataJob(job, datafeed);
const detectors = getRichDetectors(job, datafeed, this.additionalFields, false);

this.removeAllDetectors();
Expand Down

0 comments on commit 8a71415

Please sign in to comment.