Remove unused headers and variables
Original commit: elastic/x-pack-elasticsearch@c720e2f8cc
This commit is contained in:
parent
06df439db0
commit
f9de2fdc74
|
@ -27,7 +27,6 @@ import org.elasticsearch.threadpool.ExecutorBuilder;
|
|||
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
import org.elasticsearch.xpack.prelert.action.PutListAction;
|
||||
import org.elasticsearch.xpack.prelert.action.DeleteJobAction;
|
||||
import org.elasticsearch.xpack.prelert.action.DeleteModelSnapshotAction;
|
||||
import org.elasticsearch.xpack.prelert.action.GetBucketAction;
|
||||
|
@ -43,6 +42,7 @@ import org.elasticsearch.xpack.prelert.action.PostDataAction;
|
|||
import org.elasticsearch.xpack.prelert.action.PostDataCloseAction;
|
||||
import org.elasticsearch.xpack.prelert.action.PostDataFlushAction;
|
||||
import org.elasticsearch.xpack.prelert.action.PutJobAction;
|
||||
import org.elasticsearch.xpack.prelert.action.PutListAction;
|
||||
import org.elasticsearch.xpack.prelert.action.PutModelSnapshotDescriptionAction;
|
||||
import org.elasticsearch.xpack.prelert.action.ResumeJobAction;
|
||||
import org.elasticsearch.xpack.prelert.action.RevertModelSnapshotAction;
|
||||
|
@ -57,20 +57,18 @@ import org.elasticsearch.xpack.prelert.job.data.DataProcessor;
|
|||
import org.elasticsearch.xpack.prelert.job.logs.JobLogs;
|
||||
import org.elasticsearch.xpack.prelert.job.manager.AutodetectProcessManager;
|
||||
import org.elasticsearch.xpack.prelert.job.manager.JobManager;
|
||||
import org.elasticsearch.xpack.prelert.job.persistence.ElasticsearchBulkDeleterFactory;
|
||||
import org.elasticsearch.xpack.prelert.job.persistence.ElasticsearchJobProvider;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.output.parsing.AutoDetectResultProcessor;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.output.parsing.AutodetectResultsParser;
|
||||
import org.elasticsearch.xpack.prelert.job.process.normalizer.noop.NoOpRenormaliser;
|
||||
import org.elasticsearch.xpack.prelert.job.scheduler.ScheduledJobService;
|
||||
import org.elasticsearch.xpack.prelert.job.metadata.JobAllocator;
|
||||
import org.elasticsearch.xpack.prelert.job.metadata.JobLifeCycleService;
|
||||
import org.elasticsearch.xpack.prelert.job.metadata.PrelertMetadata;
|
||||
import org.elasticsearch.xpack.prelert.job.persistence.ElasticsearchBulkDeleterFactory;
|
||||
import org.elasticsearch.xpack.prelert.job.persistence.ElasticsearchJobProvider;
|
||||
import org.elasticsearch.xpack.prelert.job.process.NativeController;
|
||||
import org.elasticsearch.xpack.prelert.job.process.ProcessCtrl;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.AutodetectProcessFactory;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.BlackHoleAutodetectProcess;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.NativeAutodetectProcessFactory;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.output.parsing.AutodetectResultsParser;
|
||||
import org.elasticsearch.xpack.prelert.job.scheduler.ScheduledJobService;
|
||||
import org.elasticsearch.xpack.prelert.job.scheduler.http.HttpDataExtractorFactory;
|
||||
import org.elasticsearch.xpack.prelert.job.status.StatusReporter;
|
||||
import org.elasticsearch.xpack.prelert.job.usage.UsageReporter;
|
||||
|
@ -84,8 +82,8 @@ import org.elasticsearch.xpack.prelert.rest.job.RestGetJobsAction;
|
|||
import org.elasticsearch.xpack.prelert.rest.job.RestPauseJobAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.job.RestPutJobsAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.job.RestResumeJobAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.list.RestPutListAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.list.RestGetListAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.list.RestPutListAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.modelsnapshots.RestDeleteModelSnapshotAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.modelsnapshots.RestGetModelSnapshotsAction;
|
||||
import org.elasticsearch.xpack.prelert.rest.modelsnapshots.RestPutModelSnapshotDescriptionAction;
|
||||
|
@ -176,13 +174,13 @@ public class PrelertPlugin extends Plugin implements ActionPlugin {
|
|||
ScheduledJobService scheduledJobService = new ScheduledJobService(threadPool, client, jobProvider, dataProcessor,
|
||||
new HttpDataExtractorFactory(), System::currentTimeMillis);
|
||||
return Arrays.asList(
|
||||
jobProvider,
|
||||
jobManager,
|
||||
new JobAllocator(settings, clusterService, threadPool),
|
||||
new JobLifeCycleService(settings, client, clusterService, scheduledJobService, dataProcessor, threadPool.generic()),
|
||||
new ElasticsearchBulkDeleterFactory(client), //NORELEASE: this should use Delete-by-query
|
||||
dataProcessor
|
||||
);
|
||||
jobProvider,
|
||||
jobManager,
|
||||
new JobAllocator(settings, clusterService, threadPool),
|
||||
new JobLifeCycleService(settings, client, clusterService, scheduledJobService, dataProcessor, threadPool.generic()),
|
||||
new ElasticsearchBulkDeleterFactory(client), //NORELEASE: this should use Delete-by-query
|
||||
dataProcessor
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -212,7 +210,7 @@ public class PrelertPlugin extends Plugin implements ActionPlugin {
|
|||
RestStartJobSchedulerAction.class,
|
||||
RestStopJobSchedulerAction.class,
|
||||
RestDeleteModelSnapshotAction.class
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -244,7 +242,7 @@ public class PrelertPlugin extends Plugin implements ActionPlugin {
|
|||
new ActionHandler<>(StartJobSchedulerAction.INSTANCE, StartJobSchedulerAction.TransportAction.class),
|
||||
new ActionHandler<>(StopJobSchedulerAction.INSTANCE, StopJobSchedulerAction.TransportAction.class),
|
||||
new ActionHandler<>(DeleteModelSnapshotAction.INSTANCE, DeleteModelSnapshotAction.TransportAction.class)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public static Path resolveConfigFile(Environment env, String name) {
|
||||
|
|
|
@ -13,12 +13,9 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.ClusterStateUpdateTask;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.component.Lifecycle;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.gateway.GatewayService;
|
||||
import org.elasticsearch.xpack.prelert.action.DeleteJobAction;
|
||||
import org.elasticsearch.xpack.prelert.action.PauseJobAction;
|
||||
import org.elasticsearch.xpack.prelert.action.PutJobAction;
|
||||
|
@ -43,14 +40,11 @@ import org.elasticsearch.xpack.prelert.job.persistence.QueryPage;
|
|||
import org.elasticsearch.xpack.prelert.job.results.AnomalyRecord;
|
||||
import org.elasticsearch.xpack.prelert.utils.ExceptionsHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.prelert.job.persistence;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
|
|
|
@ -7,10 +7,7 @@ package org.elasticsearch.xpack.prelert.job.process.autodetect;
|
|||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.output.FlushAcknowledgement;
|
||||
import org.elasticsearch.xpack.prelert.job.process.autodetect.params.DataLoadParams;
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.xpack.prelert.job.usage.UsageReporter;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
package org.elasticsearch.xpack.prelert.utils;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* An interface for iterators that can have resources that will be automatically cleaned up
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.xpack.prelert.job.results.BucketInfluencer;
|
|||
import org.elasticsearch.xpack.prelert.job.results.Influencer;
|
||||
import org.elasticsearch.xpack.prelert.job.results.PartitionScore;
|
||||
import org.elasticsearch.xpack.prelert.support.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.xpack.prelert.utils.SingleDocument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.prelert.action;
|
|||
import org.elasticsearch.xpack.prelert.job.persistence.QueryPage;
|
||||
import org.elasticsearch.xpack.prelert.job.results.CategoryDefinition;
|
||||
import org.elasticsearch.xpack.prelert.support.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.xpack.prelert.utils.SingleDocument;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.elasticsearch.xpack.prelert.job.SchedulerConfig;
|
|||
import org.elasticsearch.xpack.prelert.job.transform.TransformConfig;
|
||||
import org.elasticsearch.xpack.prelert.job.transform.TransformType;
|
||||
import org.elasticsearch.xpack.prelert.support.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.xpack.prelert.utils.SingleDocument;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -20,7 +20,6 @@ public class GetRecordsActionResponseTests extends AbstractStreamableTestCase<Ge
|
|||
int listSize = randomInt(10);
|
||||
List<AnomalyRecord> hits = new ArrayList<>(listSize);
|
||||
String jobId = randomAsciiOfLengthBetween(1, 20);
|
||||
String bucketId = randomAsciiOfLengthBetween(1, 20);
|
||||
for (int j = 0; j < listSize; j++) {
|
||||
AnomalyRecord record = new AnomalyRecord(jobId);
|
||||
record.setId(randomAsciiOfLengthBetween(1, 20));
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.elasticsearch.action.bulk.BulkResponse;
|
|||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
|
@ -82,8 +81,8 @@ public class ScheduledJobsIT extends ESIntegTestCase {
|
|||
|
||||
public void testLookbackOnly() throws Exception {
|
||||
client().admin().indices().prepareCreate("data")
|
||||
.addMapping("type", "time", "type=date")
|
||||
.get();
|
||||
.addMapping("type", "time", "type=date")
|
||||
.get();
|
||||
long numDocs = randomIntBetween(32, 2048);
|
||||
long now = System.currentTimeMillis();
|
||||
long lastWeek = now - 604800000;
|
||||
|
@ -112,8 +111,8 @@ public class ScheduledJobsIT extends ESIntegTestCase {
|
|||
|
||||
public void testRealtime() throws Exception {
|
||||
client().admin().indices().prepareCreate("data")
|
||||
.addMapping("type", "time", "type=date")
|
||||
.get();
|
||||
.addMapping("type", "time", "type=date")
|
||||
.get();
|
||||
long numDocs1 = randomIntBetween(32, 2048);
|
||||
long now = System.currentTimeMillis();
|
||||
long lastWeek = System.currentTimeMillis() - 604800000;
|
||||
|
@ -143,7 +142,7 @@ public class ScheduledJobsIT extends ESIntegTestCase {
|
|||
}, 30, TimeUnit.SECONDS);
|
||||
|
||||
StopJobSchedulerAction.Request stopSchedulerRequest = new StopJobSchedulerAction.Request("_job_id");
|
||||
StopJobSchedulerAction.Response stopJobResponse = client().execute(StopJobSchedulerAction.INSTANCE, stopSchedulerRequest).get();
|
||||
client().execute(StopJobSchedulerAction.INSTANCE, stopSchedulerRequest).get();
|
||||
assertTrue(startJobResponse.isAcknowledged());
|
||||
assertBusy(() -> {
|
||||
PrelertMetadata prelertMetadata = client().admin().cluster().prepareState().all().get()
|
||||
|
|
|
@ -69,7 +69,6 @@ public class AutodetectCommunicatorTests extends ESTestCase {
|
|||
AutodetectProcess process = mockAutodetectProcessWithOutputStream();
|
||||
when(process.isProcessAlive()).thenReturn(false);
|
||||
when(process.readError()).thenReturn("Mock process is dead");
|
||||
@SuppressWarnings("resource")
|
||||
AutodetectCommunicator communicator = createAutodetectCommunicator(process, mock(AutoDetectResultProcessor.class));
|
||||
InterimResultsParams params = InterimResultsParams.builder().build();
|
||||
ElasticsearchException e = ESTestCase.expectThrows(ElasticsearchException.class, () -> communicator.flushJob(params));
|
||||
|
|
Loading…
Reference in New Issue