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 changes to exception message #803

Merged
merged 2 commits into from
Feb 9, 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 @@ -307,7 +307,7 @@ public void indexAnomalyResultException(
anomalyResultHandler.index(anomalyResult, detectorId, resultIndex);
}

if (errorMessage.contains(CommonErrorMessages.NO_CHECKPOINT_ERR_MSG) && !detector.isMultiCategoryDetector()) {
if (errorMessage.contains(CommonErrorMessages.NO_MODEL_ERR_MSG) && !detector.isMultiCategoryDetector()) {
// single stream detector raises ResourceNotFoundException containing CommonErrorMessages.NO_CHECKPOINT_ERR_MSG
// when there is no checkpoint.
// Delay real time cache update by one minute so we will have trained models by then and update the state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,7 @@ public static String getTooManyCategoricalFieldErr(int limit) {
public static final String UNKNOWN_SEARCH_QUERY_EXCEPTION_MSG =
"Feature has an unknown exception caught while executing the feature query: ";
public static final String VALIDATION_FEATURE_FAILURE = "Validation failed for feature(s) of detector %s";
public static final String NO_MODEL_ERR_MSG = "No RCF models are available either because RCF"
+ " models are not ready or all nodes are unresponsive or the system might have bugs.";

}
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@
public class AnomalyResultTransportAction extends HandledTransportAction<ActionRequest, AnomalyResultResponse> {

private static final Logger LOG = LogManager.getLogger(AnomalyResultTransportAction.class);
static final String NO_MODEL_ERR_MSG = "No RCF models are available either because RCF"
+ " models are not ready or all nodes are unresponsive or the system might have bugs.";
static final String WAIT_FOR_THRESHOLD_ERR_MSG = "Exception in waiting for threshold result";
static final String NODE_UNRESPONSIVE_ERR_MSG = "Model node is unresponsive. Mute node";
static final String READ_WRITE_BLOCKED = "Cannot read/write due to global block.";
Expand Down Expand Up @@ -699,7 +697,7 @@ private Exception coldStartIfNoModel(AtomicReference<Exception> failure, Anomaly
}
LOG.info("Trigger cold start for {}", detector.getDetectorId());
coldStart(detector);
return previousException.orElse(exp);
return previousException.orElse(new InternalFailure(adID, CommonErrorMessages.NO_MODEL_ERR_MSG));
}

private void findException(Throwable cause, String adID, AtomicReference<Exception> failure, String nodeId) {
Expand Down Expand Up @@ -830,7 +828,7 @@ public void onResponse(RCFResultResponse response) {
);
} else {
LOG.warn(NULL_RESPONSE + " {} for {}", modelID, rcfNodeID);
listener.onFailure(new InternalFailure(adID, NO_MODEL_ERR_MSG));
listener.onFailure(new InternalFailure(adID, CommonErrorMessages.NO_MODEL_ERR_MSG));
}
} catch (Exception ex) {
LOG.error(new ParameterizedMessage("Unexpected exception for [{}]", adID), ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.opensearch.ad.ExecuteADResultResponseRecorder;
import org.opensearch.ad.NodeStateManager;
import org.opensearch.ad.TestHelpers;
import org.opensearch.ad.common.exception.InternalFailure;
import org.opensearch.ad.common.exception.ResourceNotFoundException;
import org.opensearch.ad.constant.CommonErrorMessages;
import org.opensearch.ad.constant.CommonName;
Expand Down Expand Up @@ -341,7 +342,7 @@ public void testIndexException() throws IOException {
Object[] args = invocation.getArguments();
ActionListener<AnomalyResultResponse> listener = (ActionListener<AnomalyResultResponse>) args[2];

listener.onFailure(new ResourceNotFoundException(detectorId, CommonErrorMessages.NO_CHECKPOINT_ERR_MSG));
listener.onFailure(new InternalFailure(detectorId, CommonErrorMessages.NO_MODEL_ERR_MSG));

return null;
}).when(client).execute(any(AnomalyResultAction.class), any(), any());
Expand Down