Skip to content

Commit faa2424

Browse files
disable prebuilt model (#682) (#683)
* disable prebuilt model Signed-off-by: Yaliang Wu <[email protected]> * add volatile for trusted url regex Signed-off-by: Yaliang Wu <[email protected]> Signed-off-by: Yaliang Wu <[email protected]> (cherry picked from commit bbe6ef8) Co-authored-by: Yaliang Wu <[email protected]>
1 parent 3b45dbd commit faa2424

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

common/src/main/java/org/opensearch/ml/common/transport/upload/MLUploadInput.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,23 @@ public MLUploadInput(FunctionName functionName,
7373
if (version == null) {
7474
throw new IllegalArgumentException("model version is null");
7575
}
76-
if (url != null) {
77-
if (modelFormat == null) {
78-
throw new IllegalArgumentException("model format is null");
79-
}
80-
if (modelConfig == null) {
81-
throw new IllegalArgumentException("model config is null");
82-
}
76+
//TODO: enable prebuilt model in 2.6
77+
// if (url != null) {
78+
// if (modelFormat == null) {
79+
// throw new IllegalArgumentException("model format is null");
80+
// }
81+
// if (modelConfig == null) {
82+
// throw new IllegalArgumentException("model config is null");
83+
// }
84+
// }
85+
if (modelFormat == null) {
86+
throw new IllegalArgumentException("model format is null");
87+
}
88+
if (modelConfig == null) {
89+
throw new IllegalArgumentException("model config is null");
90+
}
91+
if (url == null) {
92+
throw new IllegalArgumentException("model file url is null");
8393
}
8494
this.modelName = modelName;
8595
this.version = version;

ml-algorithms/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jacocoTestCoverageVerification {
6161
rule {
6262
limit {
6363
counter = 'LINE'
64-
minimum = 0.88 //TODO: increase coverage to 0.90
64+
minimum = 0.85 //TODO: increase coverage to 0.90
6565
}
6666
limit {
6767
counter = 'BRANCH'

ml-algorithms/src/test/java/org/opensearch/ml/engine/algorithms/text_embedding/ModelHelperTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.opensearch.ml.engine.algorithms.text_embedding;
77

88
import org.junit.Before;
9+
import org.junit.Ignore;
910
import org.junit.Rule;
1011
import org.junit.Test;
1112
import org.junit.rules.ExpectedException;
@@ -69,6 +70,7 @@ public void testDownloadAndSplit() throws URISyntaxException {
6970
assertNotEquals(0, argumentCaptor.getValue().size());
7071
}
7172

73+
@Ignore
7274
@Test
7375
public void testDownloadPrebuiltModelConfig_WrongModelName() {
7476
String taskId = "test_task_id";
@@ -84,6 +86,7 @@ public void testDownloadPrebuiltModelConfig_WrongModelName() {
8486
assertEquals(PrivilegedActionException.class, argumentCaptor.getValue().getClass());
8587
}
8688

89+
@Ignore
8790
@Test
8891
public void testDownloadPrebuiltModelConfig() {
8992
String taskId = "test_task_id";

plugin/src/main/java/org/opensearch/ml/action/upload/TransportUploadModelAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class TransportUploadModelAction extends HandledTransportAction<ActionReq
6868
DiscoveryNodeHelper nodeFilter;
6969
MLTaskDispatcher mlTaskDispatcher;
7070
MLStats mlStats;
71-
String trustedUrlRegex;
71+
volatile String trustedUrlRegex;
7272

7373
@Inject
7474
public TransportUploadModelAction(

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ public void uploadMLModel(MLUploadInput uploadInput, MLTask mlTask) {
195195
if (uploadInput.getUrl() != null) {
196196
uploadModelFromUrl(uploadInput, mlTask);
197197
} else {
198-
uploadPrebuiltModel(uploadInput, mlTask);
198+
throw new IllegalArgumentException("model file URL is null");
199+
// TODO: support prebuilt model later
200+
// uploadPrebuiltModel(uploadInput, mlTask);
199201
}
200202
} catch (Exception e) {
201203
mlStats.createCounterStatIfAbsent(mlTask.getFunctionName(), UPLOAD, MLActionLevelStat.ML_ACTION_FAILURE_COUNT).increment();

0 commit comments

Comments
 (0)