Skip to content

Commit b1c5c94

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

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
import org.opensearch.ml.engine.indices.MLIndicesHandler;
133133
import org.opensearch.ml.engine.utils.FileUtils;
134134
import org.opensearch.ml.profile.MLModelProfile;
135-
import org.opensearch.ml.settings.MLFeatureEnabledSetting;
136135
import org.opensearch.ml.stats.ActionName;
137136
import org.opensearch.ml.stats.MLActionLevelStat;
138137
import org.opensearch.ml.stats.MLNodeLevelStat;
@@ -180,7 +179,6 @@ public class MLModelManager {
180179
private final MLTaskManager mlTaskManager;
181180
private final MLEngine mlEngine;
182181
private final DiscoveryNodeHelper nodeHelper;
183-
private final MLFeatureEnabledSetting mlFeatureEnabledSetting;
184182

185183
private volatile Integer maxModelPerNode;
186184
private volatile Integer maxRegisterTasksPerNode;
@@ -211,8 +209,7 @@ public MLModelManager(
211209
MLTaskManager mlTaskManager,
212210
MLModelCacheHelper modelCacheHelper,
213211
MLEngine mlEngine,
214-
DiscoveryNodeHelper nodeHelper,
215-
MLFeatureEnabledSetting mlFeatureEnabledSetting
212+
DiscoveryNodeHelper nodeHelper
216213
) {
217214
this.client = client;
218215
this.sdkClient = sdkClient;
@@ -228,7 +225,6 @@ public MLModelManager(
228225
this.mlTaskManager = mlTaskManager;
229226
this.mlEngine = mlEngine;
230227
this.nodeHelper = nodeHelper;
231-
this.mlFeatureEnabledSetting = mlFeatureEnabledSetting;
232228

233229
this.maxModelPerNode = ML_COMMONS_MAX_MODELS_PER_NODE.get(settings);
234230
clusterService.getClusterSettings().addSettingsUpdateConsumer(ML_COMMONS_MAX_MODELS_PER_NODE, it -> maxModelPerNode = it);
@@ -1334,9 +1330,6 @@ public synchronized void updateModelCache(String modelId, ActionListener<String>
13341330
*/
13351331
public synchronized void deployControllerWithDeployedModel(String modelId, ActionListener<String> listener) {
13361332
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) {
1337-
if (!mlFeatureEnabledSetting.isControllerEnabled()) {
1338-
throw new IllegalStateException(CONTROLLER_DISABLED_ERR_MSG);
1339-
}
13401333
if (!modelCacheHelper.isModelDeployed(modelId)) {
13411334
throw new OpenSearchStatusException(
13421335
"The model of this model controller has not deployed yet, please deploy the model first.",
@@ -1506,9 +1499,6 @@ private synchronized void deployControllerWithDeployingModel(
15061499
* @param mlModel ml model
15071500
*/
15081501
public void deployControllerWithDeployingModel(MLModel mlModel, Integer eligibleNodeCount) {
1509-
if (!mlFeatureEnabledSetting.isControllerEnabled()) {
1510-
throw new IllegalStateException(CONTROLLER_DISABLED_ERR_MSG);
1511-
}
15121502
if (mlModel.getModelState() != MLModelState.DEPLOYING) {
15131503
throw new OpenSearchStatusException(
15141504
"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)