-
Notifications
You must be signed in to change notification settings - Fork 140
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
Separate QuantizationStateCache teardown from KNNTestCase #2406
base: main
Are you sure you want to change the base?
Changes from 7 commits
8b14477
bec302f
812c383
045f4bd
3f2ebb0
39b5e99
06fd772
61901fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,10 @@ public void setThreadPool() { | |
} | ||
|
||
@After | ||
public void terminateThreadPool() { | ||
public void stopMaintenance() throws IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you can use cleanup() or tearDown() as a generic method name for test class cleanup. |
||
terminate(threadPool); | ||
QuantizationStateCache.setThreadPool(null); | ||
QuantizationStateCache.getInstance().close(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This call to I thought I'd include it for clarity and to immediately cancel the task, but I wanted to flag it to see if anyone had thoughts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can have it for code clarity. My concern is the Going one step further - I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess NativeMemoryCacheManager will always exist because it is created as part of plugin initialization. Thats why the Why cant we just have something like
Only in the tests where we actually have QuantizationStateCacheManager created, we can go set this value to true |
||
} | ||
|
||
@SneakyThrows | ||
|
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.
nit: I don't think we need this explicitly.
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 guess the close of NativeMemoryCacheManager should have this. Because that is where the
executor.shutdown()
is called. The same place should be used to cleanup all tasks. I see themaintenanceTask.cancel()
is called. Post that we should clear out the threadpool; no?Actually, this should not even be required as @kotwanikunal mentioned
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.
@Gankris96 the only consideration there is that the threadpool is set only once in KNNPlugin where we have access to pass in OpenSearch's threadpool. Once close() is called and that is set to null, we would lose that reference unless
KNNPlugin.createComponents
is called again. I would need to investigate the impact of getting rid of that reference fully.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 think the problem is that the threadpool is getting shutdown in the tests before you clear out the QSCache object. That is what causes the
threadpool != null
check to succeed but themockNode.shutDown()
terminates the threadpool.For example
k-NN/src/test/java/org/opensearch/knn/index/KNNSettingsTests.java
Line 64 in f5cf255