Skip to content

Commit 6edda9b

Browse files
committed
Fix IT
Signed-off-by: b4sjoo <sicheng.song@outlook.com>
1 parent 4acea8d commit 6edda9b

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

plugin/src/main/java/org/opensearch/ml/model/MLModelManager.java

+1-12
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import static org.opensearch.ml.settings.MLCommonsSettings.ML_COMMONS_MAX_REGISTER_MODEL_TASKS_PER_NODE;
4848
import static org.opensearch.ml.stats.ActionName.REGISTER;
4949
import static org.opensearch.ml.stats.MLActionLevelStat.ML_ACTION_REQUEST_COUNT;
50-
import static org.opensearch.ml.utils.MLExceptionUtils.CONTROLLER_DISABLED_ERR_MSG;
5150
import static org.opensearch.ml.utils.MLExceptionUtils.logException;
5251
import static org.opensearch.ml.utils.MLNodeUtils.checkOpenCircuitBreaker;
5352
import static org.opensearch.ml.utils.MLNodeUtils.createXContentParserFromRegistry;
@@ -132,7 +131,6 @@
132131
import org.opensearch.ml.engine.indices.MLIndicesHandler;
133132
import org.opensearch.ml.engine.utils.FileUtils;
134133
import org.opensearch.ml.profile.MLModelProfile;
135-
import org.opensearch.ml.settings.MLFeatureEnabledSetting;
136134
import org.opensearch.ml.stats.ActionName;
137135
import org.opensearch.ml.stats.MLActionLevelStat;
138136
import org.opensearch.ml.stats.MLNodeLevelStat;
@@ -180,7 +178,6 @@ public class MLModelManager {
180178
private final MLTaskManager mlTaskManager;
181179
private final MLEngine mlEngine;
182180
private final DiscoveryNodeHelper nodeHelper;
183-
private final MLFeatureEnabledSetting mlFeatureEnabledSetting;
184181

185182
private volatile Integer maxModelPerNode;
186183
private volatile Integer maxRegisterTasksPerNode;
@@ -211,8 +208,7 @@ public MLModelManager(
211208
MLTaskManager mlTaskManager,
212209
MLModelCacheHelper modelCacheHelper,
213210
MLEngine mlEngine,
214-
DiscoveryNodeHelper nodeHelper,
215-
MLFeatureEnabledSetting mlFeatureEnabledSetting
211+
DiscoveryNodeHelper nodeHelper
216212
) {
217213
this.client = client;
218214
this.sdkClient = sdkClient;
@@ -228,7 +224,6 @@ public MLModelManager(
228224
this.mlTaskManager = mlTaskManager;
229225
this.mlEngine = mlEngine;
230226
this.nodeHelper = nodeHelper;
231-
this.mlFeatureEnabledSetting = mlFeatureEnabledSetting;
232227

233228
this.maxModelPerNode = ML_COMMONS_MAX_MODELS_PER_NODE.get(settings);
234229
clusterService.getClusterSettings().addSettingsUpdateConsumer(ML_COMMONS_MAX_MODELS_PER_NODE, it -> maxModelPerNode = it);
@@ -1334,9 +1329,6 @@ public synchronized void updateModelCache(String modelId, ActionListener<String>
13341329
*/
13351330
public synchronized void deployControllerWithDeployedModel(String modelId, ActionListener<String> listener) {
13361331
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) {
1337-
if (!mlFeatureEnabledSetting.isControllerEnabled()) {
1338-
throw new IllegalStateException(CONTROLLER_DISABLED_ERR_MSG);
1339-
}
13401332
if (!modelCacheHelper.isModelDeployed(modelId)) {
13411333
throw new OpenSearchStatusException(
13421334
"The model of this model controller has not deployed yet, please deploy the model first.",
@@ -1506,9 +1498,6 @@ private synchronized void deployControllerWithDeployingModel(
15061498
* @param mlModel ml model
15071499
*/
15081500
public void deployControllerWithDeployingModel(MLModel mlModel, Integer eligibleNodeCount) {
1509-
if (!mlFeatureEnabledSetting.isControllerEnabled()) {
1510-
throw new IllegalStateException(CONTROLLER_DISABLED_ERR_MSG);
1511-
}
15121501
if (mlModel.getModelState() != MLModelState.DEPLOYING) {
15131502
throw new OpenSearchStatusException(
15141503
"This method should only be called when model is in DEPLOYING state, but the model is in state: " + mlModel.getModelState(),

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,7 @@ public Collection<Object> createComponents(
511511
mlTaskManager,
512512
modelCacheHelper,
513513
mlEngine,
514-
nodeHelper,
515-
mlFeatureEnabledSetting
514+
nodeHelper
516515
);
517516
mlInputDatasetHandler = new MLInputDatasetHandler(client);
518517
modelAccessControlHelper = new ModelAccessControlHelper(clusterService, settings);

plugin/src/test/java/org/opensearch/ml/model/MLModelManagerTests.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122
import org.opensearch.ml.engine.encryptor.EncryptorImpl;
123123
import org.opensearch.ml.engine.indices.MLIndicesHandler;
124124
import org.opensearch.ml.sdkclient.SdkClientFactory;
125-
import org.opensearch.ml.settings.MLFeatureEnabledSetting;
126125
import org.opensearch.ml.stats.ActionName;
127126
import org.opensearch.ml.stats.MLActionLevelStat;
128127
import org.opensearch.ml.stats.MLNodeLevelStat;
@@ -209,8 +208,6 @@ public class MLModelManagerTests extends OpenSearchTestCase {
209208

210209
@Mock
211210
private MLTask pretrainedMLTask;
212-
@Mock
213-
MLFeatureEnabledSetting mlFeatureEnabledSetting;
214211

215212
@Before
216213
public void setup() throws URISyntaxException, IOException {
@@ -287,7 +284,6 @@ public void setup() throws URISyntaxException, IOException {
287284
when(client.threadPool()).thenReturn(threadPool);
288285
when(threadPool.getThreadContext()).thenReturn(threadContext);
289286
when(threadPool.executor(any())).thenReturn(testThreadPool.executor(GENERAL_THREAD_POOL));
290-
when(mlFeatureEnabledSetting.isControllerEnabled()).thenReturn(true);
291287

292288
modelManager = spy(
293289
new MLModelManager(
@@ -305,8 +301,7 @@ public void setup() throws URISyntaxException, IOException {
305301
mlTaskManager,
306302
modelCacheHelper,
307303
mlEngine,
308-
nodeHelper,
309-
mlFeatureEnabledSetting
304+
nodeHelper
310305
)
311306
);
312307

0 commit comments

Comments
 (0)