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

Add basic search detectors tool; pull plugin deps in gradle run #39

Merged
merged 10 commits into from
Dec 22, 2023

Conversation

ohltyler
Copy link
Member

@ohltyler ohltyler commented Dec 19, 2023

Description

This PR adds 2 things:

  • Adds basic implementation for part of the search detectors tool. Remaining functionality will be added when the profile API is onboarded in the AD client
  • Adds dependencies on AD and job scheduler
  • Improves ./gradlew run to run an integ test cluster with ML commons, SQL, AD, and job scheduler plugins for faster iterative testing

Confirmed all build / test / run cmds work successfully on 2.11. The only difference for main is bumping to 3.0. Given the dependency list I'm not enforcing 3.0 builds to pass.

Additionally, I will manually open a backport to 2.x with the correct version

Issues Resolved

[List any issues this PR will resolve]

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.

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

A few nits.

build.gradle Outdated

configurations {
zipArchive
all {
resolutionStrategy {
force "org.mockito:mockito-core:5.8.0"
force "com.google.guava:guava:32.1.3-jre" // CVE for 31.1
force "com.google.guava:guava:32.1.2-jre" // CVE for 31.1
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a comment why we are not using the latest version? Mend will generate an auto-bump for this (if it hasn't already) and would like to include a reason when closing it to prevent future bumps...

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the catch. Reverted this as it's a leftover change from my inter-plugin dependency issues.

@zane-neo
Copy link
Collaborator

Build is failing, seems like missing dependency.

@ohltyler
Copy link
Member Author

ohltyler commented Dec 20, 2023

Build is failing, seems like missing dependency.

@zane-neo See comment in description:

Confirmed all build / test / run cmds work successfully on 2.11. The only difference for main is bumping to 3.0. Given the dependency list I'm not enforcing 3.0 builds to pass.

It is unsustainable to maintain passing builds on main since most plugin builds fail due to constant breaking changes on main/3.0. We can ensure passing builds on 2.x.

Signed-off-by: Tyler Ohlsen <[email protected]>
Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM with comments

build.gradle Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
build.gradle Show resolved Hide resolved
Signed-off-by: Tyler Ohlsen <[email protected]>
dbwiddis
dbwiddis previously approved these changes Dec 21, 2023
Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM with previous comments noted. However, not sure we should merge something that doesn't compile and breaks main. That will kill all testing of future PRs.

@dbwiddis dbwiddis self-requested a review December 21, 2023 19:32
@dbwiddis dbwiddis dismissed their stale review December 21, 2023 19:32

LGTM but dismissing approval so this doesn't get merged until dependency fixed.

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@62c9754). Click here to learn what that means.

❗ Current head 27c638f differs from pull request most recent head 00f35b0. Consider uploading reports for the commit 00f35b0 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #39   +/-   ##
=======================================
  Coverage        ?   21.21%           
  Complexity      ?        6           
=======================================
  Files           ?        3           
  Lines           ?      231           
  Branches        ?       31           
=======================================
  Hits            ?       49           
  Misses          ?      167           
  Partials        ?       15           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ohltyler
Copy link
Member Author

LGTM with previous comments noted. However, not sure we should merge something that doesn't compile and breaks main. That will kill all testing of future PRs.

I've root caused this failure - the plugin name change has changed the underlying jar path in the zip, hence not adding it to the classpath. I also got AD to build and upload to sonatype so the snapshot is now successfully pulled in CI.

@dbwiddis
Copy link
Member

the plugin name change

Ah, yes! Should have remembered that.

final Boolean highCardinality = parameters.containsKey("highCardinality")
? Boolean.parseBoolean(parameters.get("highCardinality"))
: null;
final Long lastUpdateTime = parameters.containsKey("lastUpdateTime") ? Long.parseLong(parameters.get("lastUpdateTime")) : null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Long.parseLong might throw NumberFormatException if the input parameter is null or invalid number format, suggestion is to use StringUtils.isNumeric() to check if the input is a number.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! I will update.

SearchRequest searchDetectorRequest = new SearchRequest().source(searchSourceBuilder);

if (running != null || disabled != null || failed != null) {
// TODO: add a listener to trigger when the first response is received, to trigger the profile API call
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this missed to address or will be addressed in future?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will be addressed in the future. I'll create a follow up issue alongside some other improvements soon.

@zane-neo zane-neo merged commit 9c08646 into opensearch-project:main Dec 22, 2023
3 of 11 checks passed
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.

3 participants