Skip to content

Commit 8ef451e

Browse files
committed
apply spot less
Signed-off-by: xinyual <xinyual@amazon.com>
1 parent b472292 commit 8ef451e

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed

plugin/src/main/java/org/opensearch/ml/action/models/DeleteModelTransportAction.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import static org.opensearch.ml.common.MLModel.IS_HIDDEN_FIELD;
1414
import static org.opensearch.ml.common.MLModel.MODEL_ID_FIELD;
1515
import static org.opensearch.ml.common.utils.StringUtils.getErrorMessage;
16-
import static org.opensearch.ml.settings.MLCommonsSettings.ML_COMMONS_ALLOW_MODEL_URL;
1716
import static org.opensearch.ml.settings.MLCommonsSettings.ML_COMMONS_SAFE_DELETE_MODEL;
1817
import static org.opensearch.ml.utils.MLNodeUtils.createXContentParserFromRegistry;
1918
import static org.opensearch.ml.utils.RestActionUtils.getFetchSourceContext;
@@ -164,8 +163,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener<Delete
164163
if (isModelNotDeployed(mlModelState)) {
165164
if (isSafeDelete) {
166165
checkDownstreamTaskBeforeDeleteModel(modelId, isHidden, actionListener);
167-
}
168-
else {
166+
} else {
169167
deleteModel(modelId, isHidden, actionListener);
170168
}
171169
} else {
@@ -192,8 +190,7 @@ protected void doExecute(Task task, ActionRequest request, ActionListener<Delete
192190
} else if (isModelNotDeployed(mlModelState)) {
193191
if (isSafeDelete) {
194192
checkDownstreamTaskBeforeDeleteModel(modelId, isHidden, actionListener);
195-
}
196-
else {
193+
} else {
197194
deleteModel(modelId, isHidden, actionListener);
198195
}
199196
} else {

plugin/src/main/java/org/opensearch/ml/plugin/MachineLearningPlugin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ public List<Setting<?>> getSettings() {
981981
MLCommonsSettings.ML_COMMONS_MAX_BATCH_INFERENCE_TASKS,
982982
MLCommonsSettings.ML_COMMONS_MAX_BATCH_INGESTION_TASKS,
983983
MLCommonsSettings.ML_COMMONS_BATCH_INGESTION_BULK_SIZE,
984-
MLCommonsSettings.ML_COMMONS_SAFE_DELETE_MODEL
984+
MLCommonsSettings.ML_COMMONS_SAFE_DELETE_MODEL
985985
);
986986
return settings;
987987
}

plugin/src/main/java/org/opensearch/ml/settings/MLCommonsSettings.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,5 @@ private MLCommonsSettings() {}
265265
.boolSetting("plugins.ml_commons.controller_enabled", true, Setting.Property.NodeScope, Setting.Property.Dynamic);
266266

267267
public static final Setting<Boolean> ML_COMMONS_SAFE_DELETE_MODEL = Setting
268-
.boolSetting("plugins.ml_commons.safe_delete_model", true, Setting.Property.NodeScope, Setting.Property.Dynamic);
268+
.boolSetting("plugins.ml_commons.safe_delete_model", true, Setting.Property.NodeScope, Setting.Property.Dynamic);
269269
}

plugin/src/test/java/org/opensearch/ml/action/models/DeleteModelTransportActionTests.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.opensearch.ml.action.models.DeleteModelTransportAction.TIMEOUT_MSG;
2121
import static org.opensearch.ml.common.CommonValue.ML_MODEL_INDEX;
2222
import static org.opensearch.ml.settings.MLCommonsSettings.*;
23-
import static org.opensearch.ml.settings.MLCommonsSettings.ML_COMMONS_TRUSTED_CONNECTOR_ENDPOINTS_REGEX;
2423
import static org.opensearch.ml.utils.TestHelper.clusterSetting;
2524

2625
import java.io.IOException;
@@ -67,7 +66,6 @@
6766
import org.opensearch.index.reindex.BulkByScrollResponse;
6867
import org.opensearch.index.reindex.DeleteByQueryAction;
6968
import org.opensearch.index.reindex.ScrollableHitSource;
70-
import org.opensearch.ml.action.register.TransportRegisterModelAction;
7169
import org.opensearch.ml.common.FunctionName;
7270
import org.opensearch.ml.common.MLModel;
7371
import org.opensearch.ml.common.agent.MLAgent;
@@ -150,15 +148,9 @@ public void setup() throws IOException {
150148

151149
mlModelDeleteRequest = MLModelDeleteRequest.builder().modelId("test_id").build();
152150

153-
Settings settings = Settings
154-
.builder()
155-
.put(ML_COMMONS_SAFE_DELETE_MODEL.getKey(), true)
156-
.build();
151+
Settings settings = Settings.builder().put(ML_COMMONS_SAFE_DELETE_MODEL.getKey(), true).build();
157152
threadContext = new ThreadContext(settings);
158-
ClusterSettings clusterSettings = clusterSetting(
159-
settings,
160-
ML_COMMONS_SAFE_DELETE_MODEL
161-
);
153+
ClusterSettings clusterSettings = clusterSetting(settings, ML_COMMONS_SAFE_DELETE_MODEL);
162154
when(clusterService.getClusterSettings()).thenReturn(clusterSettings);
163155
when(clusterService.getSettings()).thenReturn(settings);
164156
deleteModelTransportAction = spy(

0 commit comments

Comments
 (0)