Skip to content

Commit

Permalink
addess comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yaliang Wu <[email protected]>
  • Loading branch information
ylwu-amzn committed Aug 2, 2023
1 parent 4fa0f30 commit 91eeae3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@Log4j2
public class EncryptorImpl implements Encryptor {

public static final String MASTER_KEY_NOT_READY_ERROR = "ML encryption master key not initialized yet. Please retry after 10 seconds.";
public static final String MASTER_KEY_NOT_READY_ERROR = "The ML encryption master key has not been initialized yet. Please retry after waiting for 10 seconds.";
private ClusterService clusterService;
private Client client;
private volatile String masterKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.opensearch.ml.engine.utils;

import com.google.gson.Gson;
import lombok.extern.log4j.Log4j2;
import org.opensearch.ml.common.connector.MLPostProcessFunction;
import org.opensearch.ml.common.connector.MLPreProcessFunction;
import org.opensearch.ml.common.utils.StringUtils;
Expand All @@ -19,7 +18,6 @@
import java.util.Map;
import java.util.Optional;

@Log4j2
public class ScriptUtils {

public static final Gson gson;
Expand Down Expand Up @@ -54,12 +52,8 @@ public static Optional<String> executePostprocessFunction(ScriptService scriptSe
}

public static String executeScript(ScriptService scriptService, String painlessScript, Map<String, Object> params) {
long start = System.nanoTime();
Script script = new Script(ScriptType.INLINE, "painless", painlessScript, Collections.emptyMap());
TemplateScript templateScript = scriptService.compile(script, TemplateScript.CONTEXT).newInstance(params);
long end = System.nanoTime();
double durationInMs = (end - start) / 1e6;
log.info("----------------- painless script execution time: {} ms", durationInMs);
return templateScript.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public void createModelGroup(MLRegisterModelGroupInput input, ActionListener<Str
new IllegalArgumentException(
"The name you provided is already being used by another model with ID: "
+ id
+ ". Please provide a different name or add \"model_group_id\": \"lMPmr4kB4eSCtCCDmCDm\" to request body"
+ ". Please provide a different name or add \"model_group_id\": \""
+ id
+ "\" to request body"
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void test_ModelGroupNameNotUnique() throws IOException {//
ArgumentCaptor<Exception> argumentCaptor = ArgumentCaptor.forClass(Exception.class);
verify(actionListener).onFailure(argumentCaptor.capture());
assertEquals(
"The name you provided is already being used by another model with ID: model_group_ID. Please provide a different name or add \"model_group_id\": \"lMPmr4kB4eSCtCCDmCDm\" to request body",
"The name you provided is already being used by another model with ID: model_group_ID. Please provide a different name or add \"model_group_id\": \"model_group_ID\" to request body",
argumentCaptor.getValue().getMessage()
);

Expand Down

0 comments on commit 91eeae3

Please sign in to comment.