-
Notifications
You must be signed in to change notification settings - Fork 143
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
Throw errors on model deletion failures #834
Conversation
src/main/java/org/opensearch/knn/common/exception/DeleteModelWhenInTrainStateException.java
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/common/exception/DeleteModelWhenInTrainStateException.java
Show resolved
Hide resolved
Exception e = new ResourceNotFoundException(errorMessage); | ||
logger.error(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really interesting use of exception. In general we log the exception trace so that we know from where exception came. but here this is not the case.
If we put a log.error message here will that not be sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need exception instance to pass it to the listener.onFailure, I guess that's the main reason why we create it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we log the exception trace so that we know from where exception came. but here this is not the case.
Im not sure what you mean by this. I wanted to log the error here so that we can see the complete stack trace. We can also just log the errorMessage, but I felt adding additional information about the exception would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What information you are adding here? I see log can do the job.
Im not sure what you mean by this.
What I mean was why not log the error message in when listener.onFailure(e);
is executed, which is the line just below this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I updated.
String errorMessage = String.format("Cannot delete model [%s]. Model is still in training", modelId); | ||
Exception e = new DeleteModelWhenInTrainStateException(errorMessage); | ||
logger.error(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will track discussion above.
Do you also want to refactor the BWC tests for model Deletion? |
@naveentatikonda yes, I missed that one. Will update. |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #834 +/- ##
============================================
- Coverage 85.42% 85.28% -0.14%
- Complexity 1091 1092 +1
============================================
Files 152 153 +1
Lines 4404 4417 +13
Branches 393 392 -1
============================================
+ Hits 3762 3767 +5
- Misses 465 473 +8
Partials 177 177
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
cd6d8b0
to
6b20a9d
Compare
Throws errors on model deletion. Previously we were indicating failure, but returning 200 response codes. This changes that to throw exceptions with the correct response code. Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
Failure on windows related to: opensearch-project/OpenSearch#7080. Please review @naveentatikonda @martin-gaievski @navneet1v |
Throws errors on model deletion. Previously we were indicating failure, but returning 200 response codes. This changes that to throw exceptions with the correct response code. Signed-off-by: John Mazanec <[email protected]> (cherry picked from commit 5c3bf53)
Throws errors on model deletion. Previously we were indicating failure, but returning 200 response codes. This changes that to throw exceptions with the correct response code. Signed-off-by: John Mazanec <[email protected]> (cherry picked from commit 5c3bf53)
Throws errors on model deletion. Previously we were indicating failure, but returning 200 response codes. This changes that to throw exceptions with the correct response code. Signed-off-by: John Mazanec <[email protected]> (cherry picked from commit 5c3bf53) Co-authored-by: John Mazanec <[email protected]>
Description
Throws errors on model deletion. Previously we were indicating failure, but returning 200 response codes. This changes that to throw exceptions with the correct response code.
Deprecates constructor for DeleteModelResponse that takes an error/result, as this result should only be returned on success.
Issues Resolved
#831
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.