-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add dependent plugins validation during plugin load #1119
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Junqiu Lei <[email protected]>
e3c084f
to
724f07f
Compare
Thanks for the PR. Could you confirm it will fail in both cases?
Because we added knn and ml common code as dependency through gradle, this |
"opensearch-knn", | ||
"org.opensearch.knn.plugin.KNNPlugin", | ||
"opensearch-ml-commons", | ||
"org.opensearch.ml.client.MachineLearningClient" |
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 do not have much context. Can you please explain why org.opensearch.knn.plugin.KNNPlugin
and org.opensearch.ml.client.MachineLearningClient
still needs check even if both opensearch-knn
and opensearch-ml-commons
are available
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.
opensearch-knn
is just a plugin name we are using in a log and org.opensearch.knn.plugin.KNNPlugin
is the actual class that we are validating its existence.
I think this code might look confusing. Can we change to something like this?
public enum DependentPlugin {
private String klass;
ML_COMMON("org.opensearch.ml.client.MachineLearningClient"),
KNN("org.opensearch.knn.plugin.KNNPlugin");
DependentPlugin(final String klass) {
this.klass = klass;
}
public void validateAvailability() {
try {
Class.forName(klass);
log.info("Plugin [{}] is installed", this.name());
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Neural Search plugin requires the " + this.name() + " plugin to be installed", e);
}
}
}
Description
Add dependent plugins validation during neural search plugin load stage.
Related Issues
Closes #480
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.