Skip to content

Commit

Permalink
disable prebuilt model (#682) (#773)
Browse files Browse the repository at this point in the history
* disable prebuilt model



* add volatile for trusted url regex

Signed-off-by: Yaliang Wu <[email protected]>
  • Loading branch information
ylwu-amzn authored Mar 2, 2023
1 parent 6e178d2 commit 48f5ab8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,23 @@ public MLUploadInput(FunctionName functionName,
if (version == null) {
throw new IllegalArgumentException("model version is null");
}
if (url != null) {
if (modelFormat == null) {
throw new IllegalArgumentException("model format is null");
}
if (modelConfig == null) {
throw new IllegalArgumentException("model config is null");
}
//TODO: enable prebuilt model in 2.6
// if (url != null) {
// if (modelFormat == null) {
// throw new IllegalArgumentException("model format is null");
// }
// if (modelConfig == null) {
// throw new IllegalArgumentException("model config is null");
// }
// }
if (modelFormat == null) {
throw new IllegalArgumentException("model format is null");
}
if (modelConfig == null) {
throw new IllegalArgumentException("model config is null");
}
if (url == null) {
throw new IllegalArgumentException("model file url is null");
}
this.modelName = modelName;
this.version = version;
Expand Down
2 changes: 1 addition & 1 deletion ml-algorithms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jacocoTestCoverageVerification {
rule {
limit {
counter = 'LINE'
minimum = 0.88 //TODO: increase coverage to 0.90
minimum = 0.85 //TODO: increase coverage to 0.90
}
limit {
counter = 'BRANCH'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.opensearch.ml.engine.algorithms.text_embedding;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down Expand Up @@ -69,6 +70,7 @@ public void testDownloadAndSplit() throws URISyntaxException {
assertNotEquals(0, argumentCaptor.getValue().size());
}

@Ignore
@Test
public void testDownloadPrebuiltModelConfig_WrongModelName() {
String taskId = "test_task_id";
Expand All @@ -84,6 +86,7 @@ public void testDownloadPrebuiltModelConfig_WrongModelName() {
assertEquals(PrivilegedActionException.class, argumentCaptor.getValue().getClass());
}

@Ignore
@Test
public void testDownloadPrebuiltModelConfig() {
String taskId = "test_task_id";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class TransportUploadModelAction extends HandledTransportAction<ActionReq
DiscoveryNodeHelper nodeFilter;
MLTaskDispatcher mlTaskDispatcher;
MLStats mlStats;
String trustedUrlRegex;
volatile String trustedUrlRegex;

@Inject
public TransportUploadModelAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ public void uploadMLModel(MLUploadInput uploadInput, MLTask mlTask) {
if (uploadInput.getUrl() != null) {
uploadModelFromUrl(uploadInput, mlTask);
} else {
uploadPrebuiltModel(uploadInput, mlTask);
throw new IllegalArgumentException("model file URL is null");
// TODO: support prebuilt model later
// uploadPrebuiltModel(uploadInput, mlTask);
}
} catch (Exception e) {
mlStats.createCounterStatIfAbsent(mlTask.getFunctionName(), UPLOAD, MLActionLevelStat.ML_ACTION_FAILURE_COUNT).increment();
Expand Down

0 comments on commit 48f5ab8

Please sign in to comment.