mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
[ML] Remove unused auditor in JobResultsPersister (#73567)
The `auditor` member in `JobResultsPersister` has been left unused. This commit removes it entirely.
This commit is contained in:
parent
7477a644fb
commit
84def3cade
9 changed files with 24 additions and 46 deletions
|
@ -68,7 +68,7 @@ public class AnomalyJobCRUDIT extends MlSingleNodeTestCase {
|
|||
Settings.EMPTY
|
||||
);
|
||||
AnomalyDetectionAuditor auditor = new AnomalyDetectionAuditor(client(), clusterService);
|
||||
jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService, auditor);
|
||||
jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService);
|
||||
waitForMlTemplates();
|
||||
}
|
||||
|
||||
|
|
|
@ -163,8 +163,7 @@ public class AutodetectResultProcessorIT extends MlSingleNodeTestCase {
|
|||
auditor,
|
||||
JOB_ID,
|
||||
renormalizer,
|
||||
new JobResultsPersister(originSettingClient, resultsPersisterService,
|
||||
new AnomalyDetectionAuditor(client(), getInstanceFromNode(ClusterService.class))),
|
||||
new JobResultsPersister(originSettingClient, resultsPersisterService),
|
||||
new AnnotationPersister(resultsPersisterService),
|
||||
process,
|
||||
new ModelSizeStats.Builder(JOB_ID).build(),
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.xpack.core.ml.job.results.Bucket;
|
|||
import org.elasticsearch.xpack.ml.inference.ingest.InferenceProcessor;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider;
|
||||
import org.elasticsearch.xpack.ml.notifications.AnomalyDetectionAuditor;
|
||||
import org.elasticsearch.xpack.ml.support.BaseMlIntegTestCase;
|
||||
import org.elasticsearch.xpack.ml.utils.persistence.ResultsPersisterService;
|
||||
import org.junit.Before;
|
||||
|
@ -60,8 +59,7 @@ public class EstablishedMemUsageIT extends BaseMlIntegTestCase {
|
|||
OriginSettingClient originSettingClient = new OriginSettingClient(client(), ClientHelper.ML_ORIGIN);
|
||||
ResultsPersisterService resultsPersisterService = new ResultsPersisterService(tp, originSettingClient, clusterService, settings);
|
||||
jobResultsProvider = new JobResultsProvider(client(), settings, TestIndexNameExpressionResolver.newInstance());
|
||||
jobResultsPersister = new JobResultsPersister(
|
||||
originSettingClient, resultsPersisterService, new AnomalyDetectionAuditor(client(), clusterService));
|
||||
jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService);
|
||||
}
|
||||
|
||||
public void testEstablishedMem_givenNoResults() throws Exception {
|
||||
|
|
|
@ -6,18 +6,6 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.ml.integration;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.elasticsearch.ElasticsearchStatusException;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
|
@ -49,10 +37,21 @@ import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.Quantiles;
|
|||
import org.elasticsearch.xpack.ml.MlSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.ml.inference.ingest.InferenceProcessor;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister;
|
||||
import org.elasticsearch.xpack.ml.notifications.AnomalyDetectionAuditor;
|
||||
import org.elasticsearch.xpack.ml.utils.persistence.ResultsPersisterService;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class JobModelSnapshotCRUDIT extends MlSingleNodeTestCase {
|
||||
|
||||
private JobResultsPersister jobResultsPersister;
|
||||
|
@ -76,8 +75,7 @@ public class JobModelSnapshotCRUDIT extends MlSingleNodeTestCase {
|
|||
clusterService,
|
||||
Settings.EMPTY
|
||||
);
|
||||
AnomalyDetectionAuditor auditor = new AnomalyDetectionAuditor(client(), clusterService);
|
||||
jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService, auditor);
|
||||
jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService);
|
||||
waitForMlTemplates();
|
||||
}
|
||||
|
||||
|
|
|
@ -954,13 +954,13 @@ public class JobResultsProviderIT extends MlSingleNodeTestCase {
|
|||
|
||||
private void indexModelSizeStats(ModelSizeStats modelSizeStats) {
|
||||
JobResultsPersister persister =
|
||||
new JobResultsPersister(new OriginSettingClient(client(), ClientHelper.ML_ORIGIN), resultsPersisterService, auditor);
|
||||
new JobResultsPersister(new OriginSettingClient(client(), ClientHelper.ML_ORIGIN), resultsPersisterService);
|
||||
persister.persistModelSizeStats(modelSizeStats, () -> true);
|
||||
}
|
||||
|
||||
private void indexModelSnapshot(ModelSnapshot snapshot) {
|
||||
JobResultsPersister persister =
|
||||
new JobResultsPersister(new OriginSettingClient(client(), ClientHelper.ML_ORIGIN), resultsPersisterService, auditor);
|
||||
new JobResultsPersister(new OriginSettingClient(client(), ClientHelper.ML_ORIGIN), resultsPersisterService);
|
||||
persister.persistModelSnapshot(snapshot, WriteRequest.RefreshPolicy.IMMEDIATE, () -> true);
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ public class JobResultsProviderIT extends MlSingleNodeTestCase {
|
|||
MasterNodeRequest.DEFAULT_MASTER_NODE_TIMEOUT, future);
|
||||
future.actionGet();
|
||||
JobResultsPersister persister =
|
||||
new JobResultsPersister(new OriginSettingClient(client(), ClientHelper.ML_ORIGIN), resultsPersisterService, auditor);
|
||||
new JobResultsPersister(new OriginSettingClient(client(), ClientHelper.ML_ORIGIN), resultsPersisterService);
|
||||
persister.persistQuantiles(quantiles, () -> true);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.xpack.ml.inference.ingest.InferenceProcessor;
|
|||
import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider;
|
||||
import org.elasticsearch.xpack.ml.notifications.AnomalyDetectionAuditor;
|
||||
import org.elasticsearch.xpack.ml.support.BaseMlIntegTestCase;
|
||||
import org.elasticsearch.xpack.ml.utils.persistence.ResultsPersisterService;
|
||||
import org.junit.Before;
|
||||
|
@ -74,8 +73,7 @@ public class JobStorageDeletionTaskIT extends BaseMlIntegTestCase {
|
|||
OriginSettingClient originSettingClient = new OriginSettingClient(client(), ClientHelper.ML_ORIGIN);
|
||||
ResultsPersisterService resultsPersisterService = new ResultsPersisterService(tp, originSettingClient, clusterService, settings);
|
||||
jobResultsProvider = new JobResultsProvider(client(), settings, TestIndexNameExpressionResolver.newInstance());
|
||||
jobResultsPersister = new JobResultsPersister(
|
||||
originSettingClient, resultsPersisterService, new AnomalyDetectionAuditor(client(), clusterService));
|
||||
jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService);
|
||||
}
|
||||
|
||||
public void testUnrelatedIndexNotTouched() throws Exception {
|
||||
|
|
|
@ -237,6 +237,7 @@ import org.elasticsearch.xpack.ml.action.TransportValidateDetectorAction;
|
|||
import org.elasticsearch.xpack.ml.action.TransportValidateJobConfigAction;
|
||||
import org.elasticsearch.xpack.ml.aggs.correlation.BucketCorrelationAggregationBuilder;
|
||||
import org.elasticsearch.xpack.ml.aggs.correlation.CorrelationNamedContentProvider;
|
||||
import org.elasticsearch.xpack.ml.aggs.inference.InferencePipelineAggregationBuilder;
|
||||
import org.elasticsearch.xpack.ml.annotations.AnnotationPersister;
|
||||
import org.elasticsearch.xpack.ml.autoscaling.MlAutoscalingDeciderService;
|
||||
import org.elasticsearch.xpack.ml.autoscaling.MlAutoscalingNamedWritableProvider;
|
||||
|
@ -256,7 +257,6 @@ import org.elasticsearch.xpack.ml.dataframe.process.results.AnalyticsResult;
|
|||
import org.elasticsearch.xpack.ml.dataframe.process.results.MemoryUsageEstimationResult;
|
||||
import org.elasticsearch.xpack.ml.inference.ModelAliasMetadata;
|
||||
import org.elasticsearch.xpack.ml.inference.TrainedModelStatsService;
|
||||
import org.elasticsearch.xpack.ml.aggs.inference.InferencePipelineAggregationBuilder;
|
||||
import org.elasticsearch.xpack.ml.inference.ingest.InferenceProcessor;
|
||||
import org.elasticsearch.xpack.ml.inference.loadingservice.ModelLoadingService;
|
||||
import org.elasticsearch.xpack.ml.inference.modelsize.MlModelSizeNamedXContentProvider;
|
||||
|
@ -658,8 +658,7 @@ public class MachineLearning extends Plugin implements SystemIndexPlugin,
|
|||
);
|
||||
AnnotationPersister anomalyDetectionAnnotationPersister = new AnnotationPersister(resultsPersisterService);
|
||||
JobResultsProvider jobResultsProvider = new JobResultsProvider(client, settings, indexNameExpressionResolver);
|
||||
JobResultsPersister jobResultsPersister =
|
||||
new JobResultsPersister(originSettingClient, resultsPersisterService, anomalyDetectionAuditor);
|
||||
JobResultsPersister jobResultsPersister = new JobResultsPersister(originSettingClient, resultsPersisterService);
|
||||
JobDataCountsPersister jobDataCountsPersister = new JobDataCountsPersister(client,
|
||||
resultsPersisterService,
|
||||
anomalyDetectionAuditor);
|
||||
|
|
|
@ -47,7 +47,6 @@ import org.elasticsearch.xpack.core.ml.job.results.ForecastRequestStats;
|
|||
import org.elasticsearch.xpack.core.ml.job.results.Influencer;
|
||||
import org.elasticsearch.xpack.core.ml.job.results.ModelPlot;
|
||||
import org.elasticsearch.xpack.core.ml.utils.ToXContentParams;
|
||||
import org.elasticsearch.xpack.ml.notifications.AnomalyDetectionAuditor;
|
||||
import org.elasticsearch.xpack.ml.utils.persistence.ResultsPersisterService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -82,14 +81,11 @@ public class JobResultsPersister {
|
|||
|
||||
private final OriginSettingClient client;
|
||||
private final ResultsPersisterService resultsPersisterService;
|
||||
private final AnomalyDetectionAuditor auditor;
|
||||
|
||||
public JobResultsPersister(OriginSettingClient client,
|
||||
ResultsPersisterService resultsPersisterService,
|
||||
AnomalyDetectionAuditor auditor) {
|
||||
ResultsPersisterService resultsPersisterService) {
|
||||
this.client = client;
|
||||
this.resultsPersisterService = resultsPersisterService;
|
||||
this.auditor = auditor;
|
||||
}
|
||||
|
||||
public Builder bulkPersisterBuilder(String jobId) {
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.elasticsearch.xpack.core.ml.job.results.Influencer;
|
|||
import org.elasticsearch.xpack.core.ml.job.results.ModelPlot;
|
||||
import org.elasticsearch.xpack.core.ml.utils.ExponentialAverageCalculationContext;
|
||||
import org.elasticsearch.xpack.ml.inference.ingest.InferenceProcessor;
|
||||
import org.elasticsearch.xpack.ml.notifications.AnomalyDetectionAuditor;
|
||||
import org.elasticsearch.xpack.ml.test.MockOriginSettingClient;
|
||||
import org.elasticsearch.xpack.ml.utils.persistence.ResultsPersisterService;
|
||||
import org.junit.Before;
|
||||
|
@ -63,7 +62,6 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
|
@ -87,7 +85,7 @@ public class JobResultsPersisterTests extends ESTestCase {
|
|||
client = mock(Client.class);
|
||||
doAnswer(withResponse(mock(BulkResponse.class))).when(client).execute(eq(BulkAction.INSTANCE), any(), any());
|
||||
originSettingClient = MockOriginSettingClient.mockOriginSettingClient(client, ClientHelper.ML_ORIGIN);
|
||||
persister = new JobResultsPersister(originSettingClient, buildResultsPersisterService(originSettingClient), makeAuditor());
|
||||
persister = new JobResultsPersister(originSettingClient, buildResultsPersisterService(originSettingClient));
|
||||
}
|
||||
|
||||
public void testPersistBucket_OneRecord() {
|
||||
|
@ -410,12 +408,4 @@ public class JobResultsPersisterTests extends ESTestCase {
|
|||
|
||||
return new ResultsPersisterService(tp, client, clusterService, Settings.EMPTY);
|
||||
}
|
||||
|
||||
private AnomalyDetectionAuditor makeAuditor() {
|
||||
AnomalyDetectionAuditor anomalyDetectionAuditor = mock(AnomalyDetectionAuditor.class);
|
||||
doNothing().when(anomalyDetectionAuditor).warning(any(), any());
|
||||
doNothing().when(anomalyDetectionAuditor).info(any(), any());
|
||||
doNothing().when(anomalyDetectionAuditor).error(any(), any());
|
||||
return anomalyDetectionAuditor;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue