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

[Feature/extensions] Implements create components for AnomalyDetectionIndices and ADTaskManager #825

Merged
merged 6 commits into from
Mar 2, 2023

Conversation

joshpalis
Copy link
Member

@joshpalis joshpalis commented Feb 28, 2023

Implementing create components, commented associated test classes for components until SDKClusterSettings support is added.

Issues Resolved

Part of : opensearch-project/opensearch-sdk-java#499

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.

… components until SDKClusterSettings support is added

Signed-off-by: Joshua Palis <jpalis@amazon.com>
@joshpalis joshpalis requested review from a team, dbwiddis and owaiskazi19 February 28, 2023 02:02
…iggered from SDKRestClient

Signed-off-by: Joshua Palis <jpalis@amazon.com>
… test class, passed in SDKNamedXContentRegistry to ADTaskManagerreturning SDKRestClient as a created component to enable dependency injection, using multi-line comments s in PriorityCacheTests

Signed-off-by: Joshua Palis <jpalis@amazon.com>
Signed-off-by: Joshua Palis <jpalis@amazon.com>
@codecov-commenter
Copy link

Codecov Report

Merging #825 (209cf83) into feature/extensions (5c2c65e) will decrease coverage by 5.72%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@                   Coverage Diff                    @@
##             feature/extensions     #825      +/-   ##
========================================================
- Coverage                 45.60%   39.89%   -5.72%     
+ Complexity                 2458     2110     -348     
========================================================
  Files                       297      297              
  Lines                     17115    17094      -21     
  Branches                   1843     1843              
========================================================
- Hits                       7805     6819     -986     
- Misses                     8740     9787    +1047     
+ Partials                    570      488      -82     
Flag Coverage Δ
plugin 39.89% <0.00%> (-5.72%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...va/org/opensearch/ad/AnomalyDetectorExtension.java 0.00% <0.00%> (ø)
.../java/org/opensearch/ad/AnomalyDetectorPlugin.java 68.75% <ø> (-17.82%) ⬇️
src/main/java/org/opensearch/ad/MemoryTracker.java 5.37% <ø> (-70.97%) ⬇️
...ava/org/opensearch/ad/task/ADTaskCacheManager.java 0.00% <0.00%> (-81.24%) ⬇️
...ain/java/org/opensearch/ad/task/ADTaskManager.java 0.07% <0.00%> (-3.02%) ⬇️
.../java/org/opensearch/ad/caching/CacheProvider.java 0.00% <0.00%> (-100.00%) ⬇️
...va/org/opensearch/ad/task/ADRealtimeTaskCache.java 0.00% <0.00%> (-100.00%) ⬇️
...ain/java/org/opensearch/ad/caching/DoorKeeper.java 0.00% <0.00%> (-94.12%) ⬇️
.../java/org/opensearch/ad/task/ADBatchTaskCache.java 0.00% <0.00%> (-93.75%) ⬇️
...ava/org/opensearch/ad/task/ADHCBatchTaskCache.java 0.00% <0.00%> (-88.89%) ⬇️
... and 22 more

Signed-off-by: Joshua Palis <jpalis@amazon.com>
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 except for field/param naming. The vast majority of the diff on the ADTaskManager class can be eliminated by keeping the old names and just changing the class type.

private final Client client;
private final ClusterService clusterService;
private final NamedXContentRegistry xContentRegistry;
private final SDKRestClient sdkRestClient;
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 keep the field name client here to minimize the diff with AD plugin?

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 do

ClusterService clusterService,
Client client,
NamedXContentRegistry xContentRegistry,
Settings environmentSettings,
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 keep the parameter name settings here to minimize the diff with AD plugin?

@@ -1671,7 +1671,9 @@ protected <T> void deleteTaskDocs(
BulkRequest bulkRequest = new BulkRequest();
while (iterator.hasNext()) {
SearchHit searchHit = iterator.next();
try (XContentParser parser = createXContentParserFromRegistry(xContentRegistry, searchHit.getSourceRef())) {
try (
XContentParser parser = createXContentParserFromRegistry(xContentRegistry.getRegistry(), searchHit.getSourceRef())
Copy link
Member

Choose a reason for hiding this comment

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

Exactly as we want it. Someone (me? you?) should update the migration guide with this. Since it's part of create components should work nicely with this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure Ill take this as an action item

… client, settings. Spotless Apply

Signed-off-by: Joshua Palis <jpalis@amazon.com>
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!

@owaiskazi19
Copy link
Member

With the recent upgrade to snakeyaml 2.0. SafeConstructor can be replaced with new Yaml(); in ExtensionSettings


/home/runner/work/anomaly-detection/anomaly-detection/sdk/src/main/java/org/opensearch/sdk/ExtensionSettings.java:103: error: constructor SafeConstructor in class SafeConstructor cannot be applied to given types;
        Yaml yaml = new Yaml(new SafeConstructor());
       
        

@joshpalis
Copy link
Member Author

PR to fix the failure : opensearch-project/opensearch-sdk-java#504

@dbwiddis dbwiddis merged commit fa46964 into opensearch-project:feature/extensions Mar 2, 2023
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.

4 participants