-
Notifications
You must be signed in to change notification settings - Fork 174
Support multi-tenancy for LocalRegexGuardrail #4120
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Yuanchun Shen <[email protected]>
LGTM. |
log.error("Failed to search stop words index {}", indexName, e); | ||
hitStopWords.set(true); | ||
}), latch)); | ||
sdkClient |
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.
It seems the if...else can be merged, and check the other places using SdkClient
, try to always use the same approach like:
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) {
sdkClient.getDataObjectAsync(getDataObjectRequest).whenComplete((
Without this try block, it could cause issue some edge cases.
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.
By merging the if...else, do you mean I can always stash and restore the thread context no matter whether it is a stop word system index or not?
Actually I don't really know why it has to stash and restore the thread context when the index is a system index, but does not have to do so when the index is not. Explanations will be helpful
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4120 +/- ##
============================================
- Coverage 81.52% 81.51% -0.01%
- Complexity 8800 8806 +6
============================================
Files 761 761
Lines 38102 38108 +6
Branches 4248 4250 +2
============================================
+ Hits 31061 31063 +2
- Misses 5196 5199 +3
- Partials 1845 1846 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code coverage failed: https://github.com/opensearch-project/ml-commons/pull/4120/checks?check_run_id=48455690124, please take a look and add more tests to cover. |
Signed-off-by: Yuanchun Shen <[email protected]>
Signed-off-by: Yuanchun Shen <[email protected]>
Hi @zane-neo , I updated implementations and fixed tests. Can you help approve the CI workflows? |
Description
This PR Introduce add multi-tenancy support to LocalRegexGuardrail by introducing sdk client to perform search requests.
Related Issues
Resolves #4119
Check List
--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.