-
Notifications
You must be signed in to change notification settings - Fork 146
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
not sending failure message when model index isn't present #2351
Conversation
Signed-off-by: Dhrubo Saha <[email protected]>
Can you add more details and test results to description part ? |
Signed-off-by: Dhrubo Saha <[email protected]>
added in the description |
try { | ||
builder.startObject(); | ||
builder.endObject(); | ||
channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder)); |
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.
Is this same with the old response?
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.
Yes.
{}
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.
I didn't get why we return empty content here if failing to search hidden models. In an example case, super-admin call profile api, we could continue to exeute MLProfileAction to return profiles even if failed to search hidden models, as user is super-admin.
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 to keep the experience same. Currently if there's any model in the index/cache, we return an empty object when we call profile api. I'm just keeping the experience same.
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.
If failed to search, is it possible the profile API will have other valid response which should be returned to user ? If yes, we should not just return empty {}
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.
I tested in the newly created cluster (2.13.0) where any model isn't created. If no models in the cluster or the cluster is new, the profile output is {}
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.
I mean what if for other reason the search failed, not just for newly created cluster which has no model index
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.
Even for other reason if the search fails, we need to make sure we aren't exposing any information of hidden model. If the search fails then we don't have any visibility of which one is the hidden model.
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.
But super-admin should have permission to get everything even if hidden models, right? We shouldn't block super-admin to get information.
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.
Yeah that's true. But super admin won't know which one is the hidden model. Because depending on that search we mark hidden model. If the search isn't successful, then that marking won't happen.
Signed-off-by: Dhrubo Saha <[email protected]>
@@ -176,7 +176,11 @@ public void onResponse(SearchResponse searchResponse) { | |||
|
|||
@Override | |||
public void onFailure(Exception e) { | |||
onFailed(channel, RestStatus.INTERNAL_SERVER_ERROR, "Searching model wasn't successful", e); | |||
try { | |||
getNodeStats(finalMlStatsInput, clusterStatsMap, client, mlStatsNodesRequest, channel); |
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.
Shouldn't we check if the failure is due to index not found exception and continue the stats execution? For every other failures, we can throw exception.
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 don't want to block/throw exception for search, because that way the behavior will be different. We want to keep the experience similar like before. Please check the description for the current output.
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.
Yeah but what if this is not a new cluster and the model index is already present. But search failed due to some other reason. In that case, we should actually throw an exception right? Just like how we were doing before we added the hidden model filter. Something like this
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.
okay makes sense. user should know nothing of hidden model. got it
* not sending failure message when model index isn't present Signed-off-by: Dhrubo Saha <[email protected]> * making profile api experience same Signed-off-by: Dhrubo Saha <[email protected]> * add unit test Signed-off-by: Dhrubo Saha <[email protected]> * applying spotless Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> (cherry picked from commit be05dfc)
* not sending failure message when model index isn't present Signed-off-by: Dhrubo Saha <[email protected]> * making profile api experience same Signed-off-by: Dhrubo Saha <[email protected]> * add unit test Signed-off-by: Dhrubo Saha <[email protected]> * applying spotless Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> (cherry picked from commit be05dfc)
…2352) * not sending failure message when model index isn't present Signed-off-by: Dhrubo Saha <[email protected]> * making profile api experience same Signed-off-by: Dhrubo Saha <[email protected]> * add unit test Signed-off-by: Dhrubo Saha <[email protected]> * applying spotless Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> (cherry picked from commit be05dfc) Co-authored-by: Dhrubo Saha <[email protected]>
…2353) * not sending failure message when model index isn't present Signed-off-by: Dhrubo Saha <[email protected]> * making profile api experience same Signed-off-by: Dhrubo Saha <[email protected]> * add unit test Signed-off-by: Dhrubo Saha <[email protected]> * applying spotless Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> (cherry picked from commit be05dfc) Co-authored-by: Dhrubo Saha <[email protected]>
…h-project#2351) (opensearch-project#2352) * not sending failure message when model index isn't present Signed-off-by: Dhrubo Saha <[email protected]> * making profile api experience same Signed-off-by: Dhrubo Saha <[email protected]> * add unit test Signed-off-by: Dhrubo Saha <[email protected]> * applying spotless Signed-off-by: Dhrubo Saha <[email protected]> --------- Signed-off-by: Dhrubo Saha <[email protected]> (cherry picked from commit be05dfc) Co-authored-by: Dhrubo Saha <[email protected]>
Description
[
For a newly created cluster stats api response:
Profile api response:
]
Issues Resolved
[List any issues this PR will resolve]
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.