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

adding tenantID to the request + implement multi-tenancy in undeploy api #3425

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

dhrubo-os
Copy link
Collaborator

@dhrubo-os dhrubo-os commented Jan 23, 2025

Description

[adding tenantID to the request + implement multi-tenancy in undeploy api]

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@dhrubo-os dhrubo-os changed the title adding tenantID to the request adding tenantID to the request + undeploy request Jan 23, 2025
@dhrubo-os dhrubo-os changed the title adding tenantID to the request + undeploy request adding tenantID to the request + implement multi-tenancy in undeploy api Jan 23, 2025
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 23, 2025 22:05 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 23, 2025 22:05 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 23, 2025 23:04 — with GitHub Actions Inactive
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 52.27273% with 63 lines in your changes missing coverage. Please review.

Project coverage is 80.29%. Comparing base (f28bb74) to head (c697a5b).
Report is 173 commits behind head on main.

Files with missing lines Patch % Lines
...action/undeploy/TransportUndeployModelsAction.java 27.02% 25 Missing and 2 partials ⚠️
...tion/prediction/TransportPredictionTaskAction.java 51.11% 18 Missing and 4 partials ⚠️
...n/java/org/opensearch/ml/cluster/MLSyncUpCron.java 36.36% 1 Missing and 6 partials ⚠️
...on/transport/undeploy/MLUndeployModelsRequest.java 76.92% 3 Missing ⚠️
...ransport/undeploy/MLUndeployModelNodesRequest.java 60.00% 0 Missing and 2 partials ⚠️
...opensearch/ml/engine/indices/MLIndicesHandler.java 0.00% 0 Missing and 1 partial ⚠️
...earch/ml/engine/indices/MLInputDatasetHandler.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3425      +/-   ##
============================================
- Coverage     81.31%   80.29%   -1.02%     
- Complexity     6094     6695     +601     
============================================
  Files           573      599      +26     
  Lines         25268    29137    +3869     
  Branches       2666     3224     +558     
============================================
+ Hits          20547    23397    +2850     
- Misses         3601     4340     +739     
- Partials       1120     1400     +280     
Flag Coverage Δ
ml-commons 80.29% <52.27%> (-1.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM with one nit

@@ -68,7 +68,7 @@ public void parseSearchQueryInput(MLInputDataset mlInputDataset, ActionListener<
listener.onResponse(dfInputDataset);
return;
}, e -> {
log.error("Failed to search" + e);
log.error("Failed to search{}", e);
Copy link
Member

Choose a reason for hiding this comment

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

There's nothing to substitute here?

@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 24, 2025 00:58 — with GitHub Actions Inactive
);

client.execute(MLUndeployModelsAction.INSTANCE, mlUndeployModelsRequest, ActionListener.wrap(r -> {
MLUndeployModelNodesResponse mlUndeployModelNodesResponse = r.getResponse();
if (mlUndeployModelNodesResponse.failures() != null && mlUndeployModelNodesResponse.failures().size() != 0) {
if (mlUndeployModelNodesResponse.failures() != null && !mlUndeployModelNodesResponse.failures().isEmpty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason for this change? To avoid NPE?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

better for Readability

Copy link
Member

Choose a reason for hiding this comment

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

it's also nanoseconds faster to check empty vs. actually getting the size which requires iteration.

Here's a benchmark. The improvement is trivial but it's generally a good change. :)
https://salesforce.stackexchange.com/questions/68728/efficiency-of-list-size-0-vs-list-isempty

@dhrubo-os dhrubo-os merged commit af96fe0 into opensearch-project:main Jan 24, 2025
8 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 24, 2025
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit af96fe0)
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 24, 2025 01:57 — with GitHub Actions Inactive
dhrubo-os added a commit that referenced this pull request Jan 24, 2025
Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit af96fe0)

Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
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.

4 participants