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

[Feature/multi_tenancy] Add SearchDataObject interface, Client, and Connector Implementations #2559

Merged

Conversation

dbwiddis
Copy link
Member

@dbwiddis dbwiddis commented Jun 16, 2024

Description

  • Adds search method to SdkClient interface
  • Implements search method on Local and Remote clients
  • Migrates Connector Search action to use SdkClient for the searching
  • Updates Delete and Update connector actions which search model index to use new API

Issues Resolved

Continuation of PR #2459

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.

@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 04:11 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 04:11 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 04:11 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 04:11 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 04:11 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 04:11 — with GitHub Actions Failure
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 05:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 05:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 05:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 05:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 05:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 05:57 — with GitHub Actions Inactive
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 06:49 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 06:49 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 06:49 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 17:41 — with GitHub Actions Failure
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 23:47 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 23:47 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 16, 2024 23:47 — with GitHub Actions Inactive
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 23:48 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 23:48 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 16, 2024 23:48 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 01:33 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 01:33 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 01:33 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 01:33 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 01:33 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 01:33 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 03:04 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 03:04 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 03:04 — with GitHub Actions Failure
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 17, 2024 03:05 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 17, 2024 03:05 — with GitHub Actions Inactive
@dbwiddis dbwiddis temporarily deployed to ml-commons-cicd-env June 17, 2024 03:05 — with GitHub Actions Inactive
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 03:57 — with GitHub Actions Failure
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 03:57 — with GitHub Actions Error
@dbwiddis dbwiddis had a problem deploying to ml-commons-cicd-env June 17, 2024 03:57 — with GitHub Actions Error
* <p>
* For data storage implementations other than OpenSearch, an index may be referred to as a table
*
* @param indices the indices to search for the object
Copy link
Collaborator

Choose a reason for hiding this comment

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

How this will work? After searching in multiple indices are we going to combine the results and then send it back through SearchDataObjectResponse?

Copy link
Member Author

Choose a reason for hiding this comment

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

In practice in ML commons, there's a single index (the system index for connectors, models, etc.).

In general it can be an empty list (search all indices) or multiple indices. The search request really just packages up the entire JSON of the search query and the full response as well, parsing it back out from the XContent.

So the search response will be identical (some metadata/stats and then a list of hits).


SearchDataObjectRequest searchDataObjectRequest = new SearchDataObjectRequest.Builder()
.indices(ML_MODEL_INDEX)
.searchSourceBuilder(sourceBuilder)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should also add tenant id in the sourceBuilder?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, have you already added it to all the others? I lost track with the multiple PRs at the same time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, I haven't made any changes with search functionalities yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think @arjunkumargiri is adding tenant id in https://github.com/opensearch-project/ml-commons/pull/2553/files

It's not currently in of the other requests; probably needs to be its own standalone field.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, I'll address that accordingly after that PR is being merged.

);
}
} else {
Throwable cause = st.getCause() == null ? st : st.getCause();
Copy link
Collaborator

Choose a reason for hiding this comment

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

May be we should have a recursive method to identify the root cause as we know the exception can be wrapped with other exception. What do you think about this method:

private Throwable getRootCause(Throwable throwable) {
    Throwable cause = throwable;
    while (cause.getCause() != null && cause != cause.getCause()) {
        cause = cause.getCause();
    }
    return cause;
}

Copy link
Member Author

@dbwiddis dbwiddis Jun 18, 2024

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes! Should we refactor the code accordingly then?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly? But possibly not. I intentionally only unwrapped one level. Tracing the code, we know we're using actionGet so looking at the code we either throw the original exception (if it's a RTE) or it's a wrapped UncategorizedExecutionException containing the cause, which is what we're extracting here. So that built in recursive method is a bit too deep.

While a util method is helpful here, a ternary one-liner is also pretty brief so I'm struggling to see the huge benefit of a refactor.

So I'm open to it, but not thinking it's a high priority.

@dhrubo-os dhrubo-os merged commit 9a92eeb into opensearch-project:feature/multi_tenancy Jun 18, 2024
6 of 12 checks passed
@dbwiddis dbwiddis deleted the search-api branch June 18, 2024 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants