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

not sending failure message when model index isn't present #2351

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

dhrubo-os
Copy link
Collaborator

@dhrubo-os dhrubo-os commented Apr 23, 2024

Description

[
For a newly created cluster stats api response:

{
    "ml_model_index_status": "non-existent",
    "ml_connector_index_status": "non-existent",
    "ml_model_count": 0,
    "ml_controller_index_status": "non-existent",
    "ml_task_index_status": "non-existent",
    "ml_config_index_status": "green",
    "ml_connector_count": 0,
    "nodes": {
        "TLaJyhhfS0KeqLbdTRMJSA": {
            "ml_request_count": 0,
            "ml_executing_task_count": 0,
            "ml_deployed_model_count": 0,
            "ml_circuit_breaker_trigger_count": 0,
            "ml_jvm_heap_usage": 27,
            "ml_failure_count": 0,
            "algorithms": {},
            "models": {}
        }
    }
}

Profile api response:

{}

]

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --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.

@ylwu-amzn
Copy link
Collaborator

Can you add more details and test results to description part ?

@dhrubo-os
Copy link
Collaborator Author

Can you add more details and test results to description part ?

added in the description

ylwu-amzn
ylwu-amzn previously approved these changes Apr 23, 2024
try {
builder.startObject();
builder.endObject();
channel.sendResponse(new BytesRestResponse(RestStatus.OK, builder));
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

{}

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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 {}

Copy link
Collaborator Author

@dhrubo-os dhrubo-os Apr 23, 2024

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 {}

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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);
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Copy link
Collaborator

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

@dhrubo-os dhrubo-os merged commit be05dfc into opensearch-project:main Apr 23, 2024
12 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 23, 2024
* 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)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 23, 2024
* 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)
dhrubo-os added a commit that referenced this pull request Apr 23, 2024
…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]>
dhrubo-os added a commit that referenced this pull request Apr 23, 2024
…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]>
@mingshl mingshl added v2.14.0 bug Something isn't working labels Apr 30, 2024
dhrubo-os added a commit to dhrubo-os/ml-commons that referenced this pull request May 17, 2024
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants