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 multi-tenancy + sdk client related changes to model, model group and connector update #3399

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

dhrubo-os
Copy link
Collaborator

Description

[adding multi-tenancy + sdk client related changes to model, model group and connector update]

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 force-pushed the main branch 2 times, most recently from 25a0a94 to cb76c34 Compare January 17, 2025 00:02
@b4sjoo
Copy link
Collaborator

b4sjoo commented Jan 17, 2025

UT failed?

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

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 70.80925% with 404 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@48379ad). Learn more about missing BASE report.
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/org/opensearch/ml/model/MLModelManager.java 43.39% 205 Missing and 22 partials ⚠️
...opensearch/ml/helper/ModelAccessControlHelper.java 62.50% 15 Missing and 9 partials ⚠️
...h/ml/action/models/DeleteModelTransportAction.java 76.19% 11 Missing and 9 partials ⚠️
...a/org/opensearch/ml/model/MLModelGroupManager.java 80.23% 14 Missing and 3 partials ⚠️
...n/model_group/TransportUpdateModelGroupAction.java 83.11% 7 Missing and 6 partials ⚠️
...h/ml/action/models/UpdateModelTransportAction.java 88.18% 10 Missing and 3 partials ⚠️
...n/model_group/DeleteModelGroupTransportAction.java 84.61% 10 Missing and 2 partials ⚠️
...arch/ml/action/models/GetModelTransportAction.java 78.18% 7 Missing and 5 partials ⚠️
...search/ml/helper/ConnectorAccessControlHelper.java 62.06% 9 Missing and 2 partials ⚠️
...tion/model_group/GetModelGroupTransportAction.java 82.45% 7 Missing and 3 partials ⚠️
... and 12 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3399   +/-   ##
=======================================
  Coverage        ?   80.35%           
  Complexity      ?     6669           
=======================================
  Files           ?      599           
  Lines           ?    28841           
  Branches        ?     3187           
=======================================
  Hits            ?    23174           
  Misses          ?     4300           
  Partials        ?     1367           
Flag Coverage Δ
ml-commons 80.35% <70.80%> (?)

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.

}

@Test
public void serialization_withOlderVersion_Success() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think about adding a test for mixed versions for bwc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added.

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 18, 2025 02:48 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 18, 2025 02:48 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env January 18, 2025 03:46 — with GitHub Actions Inactive
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!

* @param excludes fields excluded
* @param listener action listener
*/
public void getModel(String modelId, String tenantId, String[] includes, String[] excludes, ActionListener<MLModel> listener) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arjunkumargiri check this method

Comment on lines +149 to +153
if (source.get(FUNCTION_NAME_FIELD) != null) {
algorithmName = source.get(FUNCTION_NAME_FIELD).toString();
} else if (source.get(ALGORITHM_FIELD) != null) {
algorithmName = source.get(ALGORITHM_FIELD).toString();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am confused about these two fields FUNCTION_NAME_FIELD and ALGORITHM_FIELD, looks like they are both to set algorithm name.

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 same what we had before:

if (getResponse.getSource() != null && getResponse.getSource().get(ALGORITHM_FIELD) != null) {
                            algorithmName = getResponse.getSource().get(ALGORITHM_FIELD).toString();
                        }

Comment on lines +156 to +158
if (!TenantAwareHelper
.validateTenantResource(mlFeatureEnabledSetting, tenantId, mlModel.getTenantId(), actionListener)) {
return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The tenanId is included in the getDataObjectRequest, may we not need this validation?

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 need to have this validation to make sure, one tenant is not accessing other tenant's resources.

RestStatus.BAD_REQUEST
)
);
if (isModelNotDeployed(mlModelState)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it be else if () to replace the above else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't clearly follow you here.

@dhrubo-os dhrubo-os merged commit f63b961 into opensearch-project:main Jan 21, 2025
10 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 21, 2025
…up and connector update (#3399)

* adding multi-tenancy + sdk client related changes to model, model group and connector update

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

* addressed comments

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

* addressed more comments + refactored few codes

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

---------

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
(cherry picked from commit f63b961)
dhrubo-os added a commit to dhrubo-os/ml-commons that referenced this pull request Jan 21, 2025
…up and connector update (opensearch-project#3399)

* adding multi-tenancy + sdk client related changes to model, model group and connector update

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

* addressed comments

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

* addressed more comments + refactored few codes

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

---------

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
dhrubo-os added a commit to dhrubo-os/ml-commons that referenced this pull request Jan 21, 2025
…up and connector update (opensearch-project#3399)

* adding multi-tenancy + sdk client related changes to model, model group and connector update

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

* addressed comments

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

* addressed more comments + refactored few codes

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

---------

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
dhrubo-os added a commit to dhrubo-os/ml-commons that referenced this pull request Jan 21, 2025
…up and connector update (opensearch-project#3399)

* adding multi-tenancy + sdk client related changes to model, model group and connector update

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

* addressed comments

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

* addressed more comments + refactored few codes

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

---------

Signed-off-by: Dhrubo Saha <dhrubo@amazon.com>
dhrubo-os added a commit that referenced this pull request Jan 22, 2025
…up and connector update (#3399) (#3415)

* adding multi-tenancy + sdk client related changes to model, model group and connector update



* addressed comments



* addressed more comments + refactored few codes



---------

Signed-off-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.

8 participants