diff --git a/.eclipseformat.xml b/.eclipseformat.xml
new file mode 100644
index 0000000000..6e93f9b22c
--- /dev/null
+++ b/.eclipseformat.xml
@@ -0,0 +1,362 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.github/workflows/CI-workflow.yml b/.github/workflows/CI-workflow.yml
index 9bcb5820d3..25421f7ee3 100644
--- a/.github/workflows/CI-workflow.yml
+++ b/.github/workflows/CI-workflow.yml
@@ -21,11 +21,11 @@ jobs:
with:
repository: 'opensearch-project/OpenSearch'
path: OpenSearch
- ref: 1.0.0-beta1
+ ref: '1.x'
- name: Build OpenSearch
working-directory: ./OpenSearch
- run: ./gradlew publishToMavenLocal -Dbuild.version_qualifier=beta1 -Dbuild.snapshot=false
+ run: ./gradlew publishToMavenLocal -Dbuild.version_qualifier=rc1 -Dbuild.snapshot=false
- name: Build with Gradle
run: ./gradlew build
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f37e5ec6ea..4050432337 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,7 +14,7 @@ buildscript {
ext {
ext {
opensearch_group = "org.opensearch"
- opensearch_version = "1.0.0-beta1"
+ opensearch_version = "1.0.0-rc1"
}
}
diff --git a/gradle.properties b/gradle.properties
index 4dd70a238d..82c9fa77f3 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -10,5 +10,5 @@
#
#
-opensearch_version=1.0.0-beta1
+opensearch_version=1.0.0-rc1
opensearchBaseVersion=1.0.0
\ No newline at end of file
diff --git a/plugin/build.gradle b/plugin/build.gradle
index d161fbe8f5..9ad7d3e9fe 100644
--- a/plugin/build.gradle
+++ b/plugin/build.gradle
@@ -15,6 +15,8 @@ plugins {
id 'nebula.ospackage'
id "io.freefair.lombok"
id 'jacoco'
+ id "com.diffplug.gradle.spotless" version "3.26.1"
+ id 'checkstyle'
}
apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.testclusters'
@@ -40,6 +42,7 @@ dependencies {
compile("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
compile group: 'com.google.guava', name: 'guava', version:'29.0-jre'
+ checkstyle "com.puppycrawl.tools:checkstyle:${project.checkstyle.toolVersion}"
}
test {
@@ -94,18 +97,34 @@ jacocoTestReport {
dependsOn test
}
+List jacocoExclusions = [
+ // TODO: add more unit test to meet the minimal test coverage.
+ 'org.opensearch.ml.action.*',
+ 'org.opensearch.ml.constant.CommonValue',
+ 'org.opensearch.ml.indices.MLInputDatasetHandler',
+ 'org.opensearch.ml.plugin.*',
+ 'org.opensearch.ml.task.MLTaskRunner',
+]
+
jacocoTestCoverageVerification {
violationRules {
rule {
- limit {
- counter = 'LINE'
- minimum = 0.7
- }
+ element = 'CLASS'
+ excludes = jacocoExclusions
limit {
counter = 'BRANCH'
minimum = 0.8
}
}
+ rule {
+ element = 'CLASS'
+ excludes = jacocoExclusions
+ limit {
+ counter = 'LINE'
+ value = 'COVEREDRATIO'
+ minimum = 0.7
+ }
+ }
}
dependsOn jacocoTestReport
}
@@ -115,4 +134,17 @@ configurations.all {
resolutionStrategy.force 'junit:junit:4.12'
resolutionStrategy.force 'org.apache.commons:commons-lang3:3.10'
resolutionStrategy.force 'commons-logging:commons-logging:1.2'
+}
+
+spotless {
+ java {
+ removeUnusedImports()
+ importOrder 'java', 'javax', 'org', 'com'
+
+ eclipse().configFile rootProject.file('.eclipseformat.xml')
+ }
+}
+
+checkstyle {
+ toolVersion = '8.29'
}
\ No newline at end of file
diff --git a/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionAction.java b/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionAction.java
index 8bef5c6728..37f58e44f2 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionAction.java
@@ -12,8 +12,8 @@
package org.opensearch.ml.action.prediction;
-import org.opensearch.ml.common.transport.prediction.MLPredictionTaskResponse;
import org.opensearch.action.ActionType;
+import org.opensearch.ml.common.transport.prediction.MLPredictionTaskResponse;
public class MLPredictionTaskExecutionAction extends ActionType {
public static MLPredictionTaskExecutionAction INSTANCE = new MLPredictionTaskExecutionAction();
diff --git a/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionTransportAction.java
index 21c74156ad..93f2704adc 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionTransportAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/prediction/MLPredictionTaskExecutionTransportAction.java
@@ -12,13 +12,13 @@
package org.opensearch.ml.action.prediction;
-import org.opensearch.ml.task.MLTaskRunner;
-import org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest;
-import org.opensearch.ml.common.transport.prediction.MLPredictionTaskResponse;
import org.opensearch.action.ActionListener;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.common.inject.Inject;
+import org.opensearch.ml.common.transport.prediction.MLPredictionTaskRequest;
+import org.opensearch.ml.common.transport.prediction.MLPredictionTaskResponse;
+import org.opensearch.ml.task.MLTaskRunner;
import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;
@@ -28,9 +28,9 @@ public class MLPredictionTaskExecutionTransportAction extends HandledTransportAc
@Inject
public MLPredictionTaskExecutionTransportAction(
- ActionFilters actionFilters,
- TransportService transportService,
- MLTaskRunner mlTaskRunner
+ ActionFilters actionFilters,
+ TransportService transportService,
+ MLTaskRunner mlTaskRunner
) {
super(MLPredictionTaskExecutionAction.NAME, transportService, actionFilters, MLPredictionTaskRequest::new);
this.mlTaskRunner = mlTaskRunner;
diff --git a/plugin/src/main/java/org/opensearch/ml/action/prediction/TransportPredictionTaskAction.java b/plugin/src/main/java/org/opensearch/ml/action/prediction/TransportPredictionTaskAction.java
index 01cf966ba9..818eff33b0 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/prediction/TransportPredictionTaskAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/prediction/TransportPredictionTaskAction.java
@@ -15,6 +15,7 @@
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import lombok.extern.log4j.Log4j2;
+
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRequest;
import org.opensearch.action.support.ActionFilters;
@@ -41,8 +42,7 @@ public TransportPredictionTaskAction(TransportService transportService, ActionFi
}
@Override
- protected void doExecute(Task task, ActionRequest request,
- ActionListener listener) {
+ protected void doExecute(Task task, ActionRequest request, ActionListener listener) {
MLPredictionTaskRequest mlPredictionTaskRequest = MLPredictionTaskRequest.fromActionRequest(request);
mlTaskRunner.runPrediction(mlPredictionTaskRequest, transportService, listener);
}
diff --git a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeRequest.java b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeRequest.java
index a77589f579..321056e67d 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeRequest.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeRequest.java
@@ -10,16 +10,16 @@
*
*/
-
package org.opensearch.ml.action.stats;
+import java.io.IOException;
+
import lombok.Getter;
+
import org.opensearch.action.support.nodes.BaseNodeRequest;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import java.io.IOException;
-
public class MLStatsNodeRequest extends BaseNodeRequest {
@Getter
private MLStatsNodesRequest mlStatsNodesRequest;
diff --git a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeResponse.java b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeResponse.java
index d7e4ed74da..d50654f2bf 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeResponse.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodeResponse.java
@@ -10,10 +10,13 @@
*
*/
-
package org.opensearch.ml.action.stats;
+import java.io.IOException;
+import java.util.Map;
+
import lombok.Getter;
+
import org.opensearch.action.support.nodes.BaseNodeResponse;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.io.stream.StreamInput;
@@ -21,9 +24,6 @@
import org.opensearch.common.xcontent.ToXContentFragment;
import org.opensearch.common.xcontent.XContentBuilder;
-import java.io.IOException;
-import java.util.Map;
-
public class MLStatsNodeResponse extends BaseNodeResponse implements ToXContentFragment {
@Getter
private Map statsMap;
diff --git a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesAction.java b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesAction.java
index 445412f2b6..f0a099add4 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesAction.java
@@ -10,11 +10,10 @@
*
*/
-
package org.opensearch.ml.action.stats;
-import org.opensearch.ml.constant.CommonValue;
import org.opensearch.action.ActionType;
+import org.opensearch.ml.constant.CommonValue;
public class MLStatsNodesAction extends ActionType {
// Internal Action which is not used for public facing RestAPIs.
diff --git a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesRequest.java b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesRequest.java
index 83918e1968..9a4559b447 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesRequest.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesRequest.java
@@ -10,19 +10,19 @@
*
*/
-
package org.opensearch.ml.action.stats;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
import lombok.Getter;
+
import org.opensearch.action.support.nodes.BaseNodesRequest;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-
public class MLStatsNodesRequest extends BaseNodesRequest {
/**
* Key indicating all stats should be retrieved
diff --git a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesResponse.java b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesResponse.java
index 7f0e6b633c..696487738c 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesResponse.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesResponse.java
@@ -10,9 +10,11 @@
*
*/
-
package org.opensearch.ml.action.stats;
+import java.io.IOException;
+import java.util.List;
+
import org.opensearch.action.FailedNodeException;
import org.opensearch.action.support.nodes.BaseNodesResponse;
import org.opensearch.cluster.ClusterName;
@@ -22,9 +24,6 @@
import org.opensearch.common.xcontent.ToXContentObject;
import org.opensearch.common.xcontent.XContentBuilder;
-import java.io.IOException;
-import java.util.List;
-
public class MLStatsNodesResponse extends BaseNodesResponse implements ToXContentObject {
private static final String NODES_KEY = "nodes";
diff --git a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesTransportAction.java
index ca1df81b59..4f3e9dca32 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesTransportAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/stats/MLStatsNodesTransportAction.java
@@ -10,29 +10,28 @@
*
*/
-
package org.opensearch.ml.action.stats;
-import org.opensearch.ml.stats.InternalStatNames;
-import org.opensearch.ml.stats.MLStats;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.opensearch.action.FailedNodeException;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.nodes.TransportNodesAction;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.io.stream.StreamInput;
+import org.opensearch.ml.stats.InternalStatNames;
+import org.opensearch.ml.stats.MLStats;
import org.opensearch.monitor.jvm.JvmService;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
public class MLStatsNodesTransportAction extends
- TransportNodesAction {
+ TransportNodesAction {
private MLStats mlStats;
private final JvmService jvmService;
@@ -48,23 +47,23 @@ public class MLStatsNodesTransportAction extends
*/
@Inject
public MLStatsNodesTransportAction(
- ThreadPool threadPool,
- ClusterService clusterService,
- TransportService transportService,
- ActionFilters actionFilters,
- MLStats mlStats,
- JvmService jvmService
+ ThreadPool threadPool,
+ ClusterService clusterService,
+ TransportService transportService,
+ ActionFilters actionFilters,
+ MLStats mlStats,
+ JvmService jvmService
) {
super(
- MLStatsNodesAction.NAME,
- threadPool,
- clusterService,
- transportService,
- actionFilters,
- MLStatsNodesRequest::new,
- MLStatsNodeRequest::new,
- ThreadPool.Names.MANAGEMENT,
- MLStatsNodeResponse.class
+ MLStatsNodesAction.NAME,
+ threadPool,
+ clusterService,
+ transportService,
+ actionFilters,
+ MLStatsNodesRequest::new,
+ MLStatsNodeRequest::new,
+ ThreadPool.Names.MANAGEMENT,
+ MLStatsNodeResponse.class
);
this.mlStats = mlStats;
this.jvmService = jvmService;
@@ -72,9 +71,9 @@ public MLStatsNodesTransportAction(
@Override
protected MLStatsNodesResponse newResponse(
- MLStatsNodesRequest request,
- List responses,
- List failures
+ MLStatsNodesRequest request,
+ List responses,
+ List failures
) {
return new MLStatsNodesResponse(clusterService.getClusterName(), responses, failures);
}
@@ -112,4 +111,3 @@ private MLStatsNodeResponse createMLStatsNodeResponse(MLStatsNodesRequest mlStat
return new MLStatsNodeResponse(clusterService.localNode(), statValues);
}
}
-
diff --git a/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionAction.java b/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionAction.java
index 2e0f5a8bd0..c89a3e1add 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionAction.java
@@ -12,8 +12,8 @@
package org.opensearch.ml.action.training;
-import org.opensearch.ml.common.transport.training.MLTrainingTaskResponse;
import org.opensearch.action.ActionType;
+import org.opensearch.ml.common.transport.training.MLTrainingTaskResponse;
public class MLTrainingTaskExecutionAction extends ActionType {
diff --git a/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionTransportAction.java b/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionTransportAction.java
index 3e3283705a..13e1780e52 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionTransportAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/training/MLTrainingTaskExecutionTransportAction.java
@@ -12,15 +12,16 @@
package org.opensearch.ml.action.training;
-import org.opensearch.ml.common.transport.training.MLTrainingTaskRequest;
-import org.opensearch.ml.common.transport.training.MLTrainingTaskResponse;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import lombok.extern.log4j.Log4j2;
+
import org.opensearch.action.ActionListener;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.common.inject.Inject;
+import org.opensearch.ml.common.transport.training.MLTrainingTaskRequest;
+import org.opensearch.ml.common.transport.training.MLTrainingTaskResponse;
import org.opensearch.ml.task.MLTaskRunner;
import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;
@@ -31,8 +32,11 @@ public class MLTrainingTaskExecutionTransportAction extends HandledTransportActi
MLTaskRunner mlTaskRunner;
@Inject
- public MLTrainingTaskExecutionTransportAction(TransportService transportService, ActionFilters actionFilters,
- MLTaskRunner mlTaskRunner) {
+ public MLTrainingTaskExecutionTransportAction(
+ TransportService transportService,
+ ActionFilters actionFilters,
+ MLTaskRunner mlTaskRunner
+ ) {
super(MLTrainingTaskExecutionAction.NAME, transportService, actionFilters, MLTrainingTaskRequest::new);
this.mlTaskRunner = mlTaskRunner;
}
diff --git a/plugin/src/main/java/org/opensearch/ml/action/training/TransportTrainingTaskAction.java b/plugin/src/main/java/org/opensearch/ml/action/training/TransportTrainingTaskAction.java
index a1a53d6189..bbaa320154 100644
--- a/plugin/src/main/java/org/opensearch/ml/action/training/TransportTrainingTaskAction.java
+++ b/plugin/src/main/java/org/opensearch/ml/action/training/TransportTrainingTaskAction.java
@@ -13,6 +13,7 @@
package org.opensearch.ml.action.training;
import lombok.extern.log4j.Log4j2;
+
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRequest;
import org.opensearch.action.support.ActionFilters;
@@ -32,8 +33,7 @@ public class TransportTrainingTaskAction extends HandledTransportAction {
- if (
- r == null ||
- r.getHits() == null ||
- r.getHits().getTotalHits() == null ||
- r.getHits().getTotalHits().value == 0
- ) {
+ if (r == null || r.getHits() == null || r.getHits().getTotalHits() == null || r.getHits().getTotalHits().value == 0) {
// todo: add specific exception
listener.onFailure(new RuntimeException("No document found"));
return;
diff --git a/plugin/src/main/java/org/opensearch/ml/model/MLTask.java b/plugin/src/main/java/org/opensearch/ml/model/MLTask.java
index e3fee43be9..fe834431ca 100644
--- a/plugin/src/main/java/org/opensearch/ml/model/MLTask.java
+++ b/plugin/src/main/java/org/opensearch/ml/model/MLTask.java
@@ -12,17 +12,18 @@
package org.opensearch.ml.model;
+import java.io.IOException;
+import java.time.Instant;
+
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
+
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Writeable;
-import java.io.IOException;
-import java.time.Instant;
-
@Getter
@EqualsAndHashCode
public class MLTask implements Writeable {
diff --git a/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java b/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java
index bb44d9a213..528a2b83e6 100644
--- a/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java
+++ b/plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java
@@ -10,10 +10,16 @@
*
*/
-
package org.opensearch.ml.plugin;
-import com.google.common.collect.ImmutableMap;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.opensearch.action.ActionRequest;
+import org.opensearch.action.ActionResponse;
import org.opensearch.client.Client;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNodeRole;
@@ -45,9 +51,6 @@
import org.opensearch.ml.stats.suppliers.CounterSupplier;
import org.opensearch.plugins.ActionPlugin;
import org.opensearch.plugins.Plugin;
-import org.opensearch.action.ActionRequest;
-import org.opensearch.action.ActionResponse;
-import com.google.common.collect.ImmutableList;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.rest.RestController;
import org.opensearch.rest.RestHandler;
@@ -57,11 +60,8 @@
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.watcher.ResourceWatcherService;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
public class MachineLearningPlugin extends Plugin implements ActionPlugin {
public static final String TASK_THREAD_POOL = "OPENSEARCH_ML_TASK_THREAD_POOL";
@@ -69,8 +69,7 @@ public class MachineLearningPlugin extends Plugin implements ActionPlugin {
private MLStats mlStats;
- public static final Setting IS_ML_NODE_SETTING =
- Setting.boolSetting("node.ml", false, Setting.Property.NodeScope);
+ public static final Setting IS_ML_NODE_SETTING = Setting.boolSetting("node.ml", false, Setting.Property.NodeScope);
public static final DiscoveryNodeRole ML_ROLE = new DiscoveryNodeRole("ml", "l") {
@Override
@@ -79,64 +78,57 @@ public Setting legacySetting() {
}
};
-
@Override
public List> getActions() {
- return ImmutableList.of(
- new ActionHandler<>(MLStatsNodesAction.INSTANCE,
- MLStatsNodesTransportAction.class),
+ return ImmutableList
+ .of(
+ new ActionHandler<>(MLStatsNodesAction.INSTANCE, MLStatsNodesTransportAction.class),
new ActionHandler<>(MLPredictionTaskAction.INSTANCE, TransportPredictionTaskAction.class),
new ActionHandler<>(MLTrainingTaskAction.INSTANCE, TransportTrainingTaskAction.class),
- new ActionHandler<>(MLPredictionTaskExecutionAction.INSTANCE,
- MLPredictionTaskExecutionTransportAction.class),
+ new ActionHandler<>(MLPredictionTaskExecutionAction.INSTANCE, MLPredictionTaskExecutionTransportAction.class),
new ActionHandler<>(MLTrainingTaskExecutionAction.INSTANCE, MLTrainingTaskExecutionTransportAction.class)
- );
+ );
}
@Override
- public Collection