Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Dhrubo Saha <[email protected]>
  • Loading branch information
dhrubo-os committed Aug 10, 2023
1 parent d236cd6 commit de0a996
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions plugin/src/main/java/org/opensearch/ml/model/MLModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,9 @@ private void deleteModel(String modelId) {
}

private void handleException(FunctionName functionName, String taskId, Exception e) {
if (!(e instanceof MLLimitExceededException) && !(e instanceof MLResourceNotFoundException) &&
!(e instanceof IllegalArgumentException)) {
if (!(e instanceof MLLimitExceededException)
&& !(e instanceof MLResourceNotFoundException)
&& !(e instanceof IllegalArgumentException)) {
mlStats.createCounterStatIfAbsent(functionName, REGISTER, MLActionLevelStat.ML_ACTION_FAILURE_COUNT).increment();
mlStats.getStat(MLNodeLevelStat.ML_NODE_TOTAL_FAILURE_COUNT).increment();
}
Expand Down Expand Up @@ -841,8 +842,9 @@ public void deployModel(

private void handleDeployModelException(String modelId, FunctionName functionName, ActionListener<String> listener, Exception e) {

if (!(e instanceof MLLimitExceededException) && !(e instanceof MLResourceNotFoundException) &&
!(e instanceof IllegalArgumentException)) {
if (!(e instanceof MLLimitExceededException)
&& !(e instanceof MLResourceNotFoundException)
&& !(e instanceof IllegalArgumentException)) {
mlStats.createCounterStatIfAbsent(functionName, ActionName.DEPLOY, MLActionLevelStat.ML_ACTION_FAILURE_COUNT).increment();
mlStats.getStat(MLNodeLevelStat.ML_NODE_TOTAL_FAILURE_COUNT).increment();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public static String toJsonString(Map<String, String> nodeErrors) throws IOExcep

public static void logException(String errorMessage, Exception e, Logger log) {
Throwable rootCause = ExceptionUtils.getRootCause(e);
if (e instanceof MLLimitExceededException || e instanceof MLResourceNotFoundException) {
if (e instanceof MLLimitExceededException || e instanceof MLResourceNotFoundException || e instanceof IllegalArgumentException) {
log.warn(e.getMessage());
} else if (rootCause instanceof MLLimitExceededException || rootCause instanceof MLResourceNotFoundException) {
} else if (rootCause instanceof MLLimitExceededException || rootCause instanceof MLResourceNotFoundException || rootCause instanceof IllegalArgumentException) {
log.warn(rootCause.getMessage());
} else {
log.error(errorMessage, e);
Expand Down

0 comments on commit de0a996

Please sign in to comment.