Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Remove jackson-databind and jackson-annotations dependencies now coming from core (#652)" #684

Merged
merged 2 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ dependencies {
implementation group: 'org.opensearch', name: 'opensearch', version: "${opensearch_version}"
implementation "org.opensearch.client:opensearch-rest-client:${opensearch_version}"
implementation "org.opensearch:common-utils:${common_utils_version}"
implementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
implementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}")
implementation group: 'com.google.guava', name: 'guava', version: '31.0.1-jre'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
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