From be0b8575c140718d319b2d828bea6c50f09682c2 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Mon, 21 Nov 2016 16:30:01 +0000 Subject: [PATCH] Remove averageBucketProcessingTime from Job (elastic/elasticsearch#351) Original commit: elastic/x-pack-elasticsearch@60703caa1b3cf967ca518aad3ae98beabbbcaa9a --- .../elasticsearch/xpack/prelert/job/Job.java | 31 +++---------------- .../action/GetJobActionResponseTests.java | 3 +- .../xpack/prelert/job/JobTests.java | 3 -- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java index aa6317f22b6..fda6195e276 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java @@ -46,8 +46,8 @@ import java.util.regex.Pattern; */ public class Job extends AbstractDiffable implements Writeable, ToXContent { - public static final Job PROTO = new Job(null, null, null, null, null, 0L, null, null, null, null, null, - null, null, null, null, null, null, null, null, null); + public static final Job PROTO = + new Job(null, null, null, null, null, 0L, null, null, null, null, null, null, null, null, null, null, null, null, null); public static final long DEFAULT_BUCKETSPAN = 300; @@ -74,7 +74,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent public static final ParseField RESULTS_RETENTION_DAYS = new ParseField("resultsRetentionDays"); public static final ParseField TIMEOUT = new ParseField("timeout"); public static final ParseField TRANSFORMS = new ParseField("transforms"); - public static final ParseField AVERAGE_BUCKET_PROCESSING_TIME = new ParseField("averageBucketProcessingTimeMs"); public static final ParseField MODEL_SNAPSHOT_ID = new ParseField("modelSnapshotId"); public static final ObjectParser PARSER = new ObjectParser<>("job_details", Builder::new); @@ -121,7 +120,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent PARSER.declareLong(Builder::setResultsRetentionDays, RESULTS_RETENTION_DAYS); PARSER.declareLong(Builder::setModelSnapshotRetentionDays, MODEL_SNAPSHOT_RETENTION_DAYS); PARSER.declareField(Builder::setCustomSettings, (p, c) -> p.map(), CUSTOM_SETTINGS, ValueType.OBJECT); - PARSER.declareDouble(Builder::setAverageBucketProcessingTimeMs, AVERAGE_BUCKET_PROCESSING_TIME); PARSER.declareStringOrNull(Builder::setModelSnapshotId, MODEL_SNAPSHOT_ID); } @@ -144,7 +142,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent private final Long modelSnapshotRetentionDays; private final Long resultsRetentionDays; private final Map customSettings; - private final Double averageBucketProcessingTimeMs; private final String modelSnapshotId; public Job(String jobId, String description, Date createTime, Date finishedTime, Date lastDataTime, long timeout, @@ -152,7 +149,7 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent DataDescription dataDescription, List transforms, ModelDebugConfig modelDebugConfig, IgnoreDowntime ignoreDowntime, Long renormalizationWindowDays, Long backgroundPersistInterval, Long modelSnapshotRetentionDays, Long resultsRetentionDays, - Map customSettings, Double averageBucketProcessingTimeMs, String modelSnapshotId) { + Map customSettings, String modelSnapshotId) { this.jobId = jobId; this.description = description; this.createTime = createTime; @@ -171,7 +168,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent this.modelSnapshotRetentionDays = modelSnapshotRetentionDays; this.resultsRetentionDays = resultsRetentionDays; this.customSettings = customSettings; - this.averageBucketProcessingTimeMs = averageBucketProcessingTimeMs; this.modelSnapshotId = modelSnapshotId; } @@ -194,7 +190,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent modelSnapshotRetentionDays = in.readOptionalLong(); resultsRetentionDays = in.readOptionalLong(); customSettings = in.readMap(); - averageBucketProcessingTimeMs = in.readOptionalDouble(); modelSnapshotId = in.readOptionalString(); } @@ -356,10 +351,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent return customSettings; } - public Double getAverageBucketProcessingTimeMs() { - return averageBucketProcessingTimeMs; - } - public String getModelSnapshotId() { return modelSnapshotId; } @@ -432,7 +423,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent out.writeOptionalLong(modelSnapshotRetentionDays); out.writeOptionalLong(resultsRetentionDays); out.writeMap(customSettings); - out.writeOptionalDouble(averageBucketProcessingTimeMs); out.writeOptionalString(modelSnapshotId); } @@ -489,9 +479,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent if (customSettings != null) { builder.field(CUSTOM_SETTINGS.getPreferredName(), customSettings); } - if (averageBucketProcessingTimeMs != null) { - builder.field(AVERAGE_BUCKET_PROCESSING_TIME.getPreferredName(), averageBucketProcessingTimeMs); - } if (modelSnapshotId != null){ builder.field(MODEL_SNAPSHOT_ID.getPreferredName(), modelSnapshotId); } @@ -576,7 +563,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent private Long resultsRetentionDays; private IgnoreDowntime ignoreDowntime; private Map customSettings; - private Double averageBucketProcessingTimeMs; private String modelSnapshotId; public Builder() { @@ -603,7 +589,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent this.resultsRetentionDays = job.getResultsRetentionDays(); this.ignoreDowntime = job.getIgnoreDowntime(); this.customSettings = job.getCustomSettings(); - this.averageBucketProcessingTimeMs = job.getAverageBucketProcessingTimeMs(); this.modelSnapshotId = job.getModelSnapshotId(); } @@ -696,10 +681,6 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent this.ignoreDowntime = ignoreDowntime; } - public void setAverageBucketProcessingTimeMs(Double averageBucketProcessingTimeMs) { - this.averageBucketProcessingTimeMs = averageBucketProcessingTimeMs; - } - public void setModelSnapshotId(String modelSnapshotId) { this.modelSnapshotId = modelSnapshotId; } @@ -757,21 +738,18 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent Date createTime; Date finishedTime; Date lastDataTime; - Double averageBucketProcessingTimeMs; String modelSnapshotId; if (fromApi) { id = this.id == null ? UUIDs.base64UUID().toLowerCase(Locale.ROOT): this.id; createTime = this.createTime == null ? new Date() : this.createTime; finishedTime = null; lastDataTime = null; - averageBucketProcessingTimeMs = null; modelSnapshotId = null; } else { id = this.id; createTime = this.createTime; finishedTime = this.finishedTime; lastDataTime = this.lastDataTime; - averageBucketProcessingTimeMs = this.averageBucketProcessingTimeMs; modelSnapshotId = this.modelSnapshotId; } if (id.length() > MAX_JOB_ID_LENGTH) { @@ -783,8 +761,7 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent return new Job( id, description, createTime, finishedTime, lastDataTime, timeout, analysisConfig, analysisLimits, schedulerConfig, dataDescription, transforms, modelDebugConfig, ignoreDowntime, renormalizationWindowDays, - backgroundPersistInterval, modelSnapshotRetentionDays, resultsRetentionDays, customSettings, - averageBucketProcessingTimeMs, modelSnapshotId + backgroundPersistInterval, modelSnapshotRetentionDays, resultsRetentionDays, customSettings, modelSnapshotId ); } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/action/GetJobActionResponseTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/action/GetJobActionResponseTests.java index 3ff530fa6ce..1022f4fbf00 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/action/GetJobActionResponseTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/action/GetJobActionResponseTests.java @@ -60,12 +60,11 @@ public class GetJobActionResponseTests extends AbstractStreamableTestCase customConfig = randomBoolean() ? Collections.singletonMap(randomAsciiOfLength(10), randomAsciiOfLength(10)) : null; - Double averageBucketProcessingTimeMs = randomBoolean() ? randomDouble() : null; String modelSnapshotId = randomBoolean() ? randomAsciiOfLength(10) : null; Job job = new Job(jobId, description, createTime, finishedTime, lastDataTime, timeout, analysisConfig, analysisLimits, schedulerConfig.build(), dataDescription, transformConfigList, modelDebugConfig, ignoreDowntime, normalizationWindowDays, backgroundPersistInterval, - modelSnapshotRetentionDays, resultsRetentionDays, customConfig, averageBucketProcessingTimeMs, modelSnapshotId); + modelSnapshotRetentionDays, resultsRetentionDays, customConfig, modelSnapshotId); DataCounts dataCounts = null; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/JobTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/JobTests.java index 5efd3b8e94b..2fbd9281678 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/JobTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/job/JobTests.java @@ -631,9 +631,6 @@ public class JobTests extends AbstractSerializingTestCase { if (randomBoolean()) { builder.setCustomSettings(Collections.singletonMap(randomAsciiOfLength(10), randomAsciiOfLength(10))); } - if (randomBoolean()) { - builder.setAverageBucketProcessingTimeMs(randomDouble()); - } if (randomBoolean()) { builder.setModelSnapshotId(randomAsciiOfLength(10)); }