-
Notifications
You must be signed in to change notification settings - Fork 138
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
fix more places where thread context not restored #1421
Conversation
Signed-off-by: Yaliang Wu <[email protected]>
Signed-off-by: Yaliang Wu <[email protected]>
modelAccessControlHelper.validateModelGroupAccess(user, mlModel.getModelGroupId(), client, listener); | ||
}, e -> { | ||
log.error("Failed to find Model", e); | ||
listener.onFailure(e); | ||
})); | ||
}), () -> context.restore())); |
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.
Isn't the context restored anyway after this statement?
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.
yes, but the action listener is running inside it
@@ -80,6 +80,7 @@ public void search(SearchRequest request, ActionListener<SearchResponse> actionL | |||
User user = RestActionUtils.getUserContext(client); | |||
ActionListener<SearchResponse> listener = wrapRestActionListener(actionListener, "Fail to search model version"); | |||
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) { | |||
ActionListener<SearchResponse> wrappedListener = ActionListener.runBefore(listener, () -> context.restore()); |
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.
I assume we can't provide this listener as generic from utils because context doesn't exist?
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.
yes
@@ -9,6 +9,8 @@ | |||
import static org.opensearch.ml.common.CommonValue.ML_MODEL_INDEX; | |||
import static org.opensearch.ml.utils.RestActionUtils.PARAMETER_MODEL_GROUP_ID; | |||
|
|||
import javax.swing.*; |
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.
Self review and find this , should remove this line
Signed-off-by: Yaliang Wu <[email protected]>
Codecov Report
@@ Coverage Diff @@
## 2.9 #1421 +/- ##
============================================
- Coverage 78.81% 78.73% -0.09%
- Complexity 2156 2160 +4
============================================
Files 168 168
Lines 8767 8775 +8
Branches 878 878
============================================
- Hits 6910 6909 -1
- Misses 1456 1465 +9
Partials 401 401
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…#1421) * fix more places where thread context not restored Signed-off-by: Yaliang Wu <[email protected]> * fix failed ut Signed-off-by: Yaliang Wu <[email protected]> * remove unused import Signed-off-by: Yaliang Wu <[email protected]> --------- Signed-off-by: Yaliang Wu <[email protected]>
* fix more places where thread context not restored * fix failed ut * remove unused import --------- Signed-off-by: Yaliang Wu <[email protected]>
* fix more places where thread context not restored * fix failed ut * remove unused import --------- Signed-off-by: Yaliang Wu <[email protected]> (cherry picked from commit d8c1162)
) * fix more places where thread context not restored * fix failed ut * remove unused import --------- Signed-off-by: Yaliang Wu <[email protected]> (cherry picked from commit d8c1162) Co-authored-by: Yaliang Wu <[email protected]>
…#1421) (opensearch-project#1423) (opensearch-project#1436) * fix more places where thread context not restored * fix failed ut * remove unused import --------- Signed-off-by: Yaliang Wu <[email protected]> (cherry picked from commit d8c1162) Co-authored-by: Yaliang Wu <[email protected]> Signed-off-by: TrungBui59 <[email protected]>
Description
Continue of #1418
Issues Resolved
[List any issues this PR will resolve]
Check List
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.