-
Notifications
You must be signed in to change notification settings - Fork 184
make MLSdkAsyncHttpResponseHandler return IllegalArgumentException #4182
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
Conversation
Signed-off-by: Brian Flores <[email protected]>
| ModelTensors tensors = processOutput(action, body, connector, scriptService, parameters, mlGuard); | ||
| tensors.setStatusCode(statusCode); | ||
| actionListener.onResponse(new Tuple<>(executionContext.getSequence(), tensors)); | ||
| } catch (IllegalArgumentException 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.
Can we also try to catch the OpensearchStatus Exception too in another catch block?
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.
Ah good catch would need to look what scenarios cause a OpensearchStatus to occur
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.
After checking again the try block does not do any other operations that would produce OpensearchStatusException. All the edge cases would only result in a illegalArgumentException
Line 206 in 2a15074
| ModelTensors tensors = processOutput(action, body, connector, scriptService, parameters, mlGuard); |
If we happen to find such error we will be able to see if through the log statement on the generic exception which would be very unlikely. The only other method that can throw a exception would be the
connector.parseResponse method which throws a IOException
Line 257 in 5cabf63
| connector.parseResponse(filteredResponse, modelTensors, scriptReturnModelTensor); |
TLDR: adding a catch block OpensearchStatusException would be dead code, and making a test for it wouldnt be useful as we would just be mocking a scenario that doesn't exist
Signed-off-by: Brian Flores <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4182 +/- ##
=========================================
Coverage 82.01% 82.01%
- Complexity 9183 9195 +12
=========================================
Files 789 789
Lines 39567 39569 +2
Branches 4389 4389
=========================================
+ Hits 32450 32454 +4
+ Misses 5227 5225 -2
Partials 1890 1890
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.19 2.19
# Navigate to the new working tree
cd .worktrees/backport-2.19
# Create a new branch
git switch --create backport/backport-4182-to-2.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f83026c006be15217414e005f50c9cbecc54d10a
# Push it to GitHub
git push --set-upstream origin backport/backport-4182-to-2.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.19Then, create a pull request where the |
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-3.0 3.0
# Navigate to the new working tree
cd .worktrees/backport-3.0
# Create a new branch
git switch --create backport/backport-4182-to-3.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f83026c006be15217414e005f50c9cbecc54d10a
# Push it to GitHub
git push --set-upstream origin backport/backport-4182-to-3.0
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-3.0Then, create a pull request where the |
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-3.1 3.1
# Navigate to the new working tree
cd .worktrees/backport-3.1
# Create a new branch
git switch --create backport/backport-4182-to-3.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f83026c006be15217414e005f50c9cbecc54d10a
# Push it to GitHub
git push --set-upstream origin backport/backport-4182-to-3.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-3.1Then, create a pull request where the |
…4182) * make MLSdkAsyncHttpResponseHandler return IllegalArgumentException Signed-off-by: Brian Flores <[email protected]> * empty commit to trigger CI Signed-off-by: Brian Flores <[email protected]> --------- Signed-off-by: Brian Flores <[email protected]> Co-authored-by: Dhrubo Saha <[email protected]> (cherry picked from commit f83026c)
Description
This is a mitigation for #4170
But would need a more thorough code change so that clients can handle properly all situations.
Related Issues
#4170 can be closed but discussion can be done to consider different types of failures
Testing
./gradlew spotlessApply
./gradlew test
Check List
--signoff.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.