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

Added a new parse util method to avoid repetition / refactored code with new method #721

Merged

Conversation

martinpkr
Copy link
Contributor

Description

This change adds a static util method that helps with reusing a piece of code and avoids repetition for the future

Issues Resolved

Will resolve [FEATURE] Create a new Util method for a common pattern -> #720

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.

@github-actions github-actions bot added the backport 2.x backport PRs to 2.x branch label May 30, 2024
@martinpkr martinpkr force-pushed the added-new-parse-util-method branch from 8d3f42c to 0e4071e Compare May 30, 2024 13:27
@dbwiddis dbwiddis linked an issue May 30, 2024 that may be closed by this pull request
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.

Thanks for your contribution! This looks great!

Note there's 2 more changes upcoming in #718, so if that gets merged first you can update, or if your PR gets merged first than @owaiskazi19 can update. :)

Can you make a few naming changes to make the method more generic? Also we need to add a CHANGELOG entry and add a unit test in ParseUtilsTest?

@martinpkr
Copy link
Contributor Author

martinpkr commented May 30, 2024 via email

@martinpkr martinpkr requested a review from dbwiddis May 30, 2024 17:05
@martinpkr martinpkr force-pushed the added-new-parse-util-method branch 4 times, most recently from 02413df to 215710f Compare May 31, 2024 09:45
@martinpkr
Copy link
Contributor Author

martinpkr commented May 31, 2024 via email

@owaiskazi19
Copy link
Member

owaiskazi19 commented May 31, 2024

@martinpkr you also need to amend your changes with -s for the DCO check to pass.
git commit -s --amend and also need to run ./gradlew spotlessApply to format the changes

@dbwiddis
Copy link
Member

@martinpkr thanks for your patience working through code review! one note: you do need to sign your commits with DCO (Signed-off-by: Your Name [email protected]). If committing on git command line just use -s assuming you've configured your name and email in git.

Also be sure to run ./gradlew spotlessApply and add a change log entry!

@owaiskazi19
Copy link
Member

owaiskazi19 commented Jun 1, 2024

add a change log entry!

@dbwiddis since this PR just adds a util method, we can ignore the CHANGELOG. Wdyt?
@martinpkr javadoc check is failing with the below

Error: eckstyle] [ERROR] /home/runner/work/flow-framework/flow-framework/src/main/java/org/opensearch/flowframework/util/ParseUtils.java:485:20: Expected @param tag for '<T>'. [JavadocMethod]

@martinpkr martinpkr force-pushed the added-new-parse-util-method branch from 4c847fc to 5f20442 Compare June 1, 2024 10:23
@martinpkr
Copy link
Contributor Author

martinpkr commented Jun 1, 2024

Signed off my commits and did an changelog entry for the issue,also fixed the javadoc to include info about , tell me if there is anything else .

@owaiskazi19
Copy link
Member

Signed off my commits and did an changelog entry for the issue,also fixed the javadoc to include info about , tell me if there is anything else .

Just ./gradlew :spotlessApply is left and we should be good to merge this.

@martinpkr
Copy link
Contributor Author

Signed off my commits and did an changelog entry for the issue,also fixed the javadoc to include info about , tell me if there is anything else .

Just ./gradlew :spotlessApply is left and we should be good to merge this.

just done that , see if everything is okay now... first time using gradle, so i'm sorry for the confusion.

@martinpkr martinpkr force-pushed the added-new-parse-util-method branch 2 times, most recently from fca8b56 to 9f92614 Compare June 2, 2024 18:21
dbwiddis and others added 4 commits June 2, 2024 21:29
* Add user mapping to Workflow State index

Signed-off-by: Daniel Widdis <[email protected]>

* Increment schema version

Signed-off-by: Daniel Widdis <[email protected]>

---------

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: martinpkr <[email protected]>
@martinpkr martinpkr force-pushed the added-new-parse-util-method branch from adb1660 to e4e62ee Compare June 2, 2024 18:29
CHANGELOG.md Outdated Show resolved Hide resolved
martinpkr and others added 12 commits June 2, 2024 21:33
Signed-off-by: martinpkr <[email protected]>
* Initial commit for reindex workflow step with extra params

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed PR comments

Signed-off-by: owaiskazi19 <[email protected]>

* Changed request per second to Float

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed string array for source indices and removed state index entry

Signed-off-by: owaiskazi19 <[email protected]>

* Minor comments

Signed-off-by: owaiskazi19 <[email protected]>

---------

Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: martinpkr <[email protected]>
* Initial commit for reindex workflow step with extra params

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed PR comments

Signed-off-by: owaiskazi19 <[email protected]>

* Changed request per second to Float

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed string array for source indices and removed state index entry

Signed-off-by: owaiskazi19 <[email protected]>

* Minor comments

Signed-off-by: owaiskazi19 <[email protected]>

---------

Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: martinpkr <[email protected]>
Signed-off-by: martinpkr <[email protected]>
* Initial commit for reindex workflow step with extra params

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed PR comments

Signed-off-by: owaiskazi19 <[email protected]>

* Changed request per second to Float

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed string array for source indices and removed state index entry

Signed-off-by: owaiskazi19 <[email protected]>

* Minor comments

Signed-off-by: owaiskazi19 <[email protected]>

---------

Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: martinpkr <[email protected]>
Copy link

codecov bot commented Jun 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.41%. Comparing base (d027c74) to head (31d3ff3).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #721      +/-   ##
============================================
+ Coverage     74.33%   74.41%   +0.07%     
- Complexity      742      744       +2     
============================================
  Files            84       84              
  Lines          3807     3811       +4     
  Branches        332      330       -2     
============================================
+ Hits           2830     2836       +6     
  Misses          823      823              
+ Partials        154      152       -2     

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

@martinpkr martinpkr force-pushed the added-new-parse-util-method branch from cec9081 to ee6b0a0 Compare June 2, 2024 18:34
@martinpkr martinpkr force-pushed the added-new-parse-util-method branch from 19bf570 to ec25f91 Compare June 2, 2024 18:37
Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

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

All the checks passed. Thanks @martinpkr for addressing the comments patiently. Welcome to the club and feel free to pick up other good first issues as well.

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!

Thanks @martinpkr for your patience here and expanding this PR to be much more useful than we originally envisioned!

@dbwiddis dbwiddis merged commit 13b32f1 into opensearch-project:main Jun 3, 2024
32 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 3, 2024
…ith new method (#721)

* Add user mapping to Workflow State index (#705)

* Add user mapping to Workflow State index

Signed-off-by: Daniel Widdis <[email protected]>

* Increment schema version

Signed-off-by: Daniel Widdis <[email protected]>

---------

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: martinpkr <[email protected]>

* Added a new parse util method to avoid repetition / refactored code with new method

Signed-off-by: martinpkr <[email protected]>

* refactored method name and added unit test

Signed-off-by: martinpkr <[email protected]>

* made method use generics + added test

Signed-off-by: martinpkr <[email protected]>

* fixed javadoc

Signed-off-by: martinpkr <[email protected]>

* Added workflow step for ReIndex Step (#718)

* Initial commit for reindex workflow step with extra params

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed PR comments

Signed-off-by: owaiskazi19 <[email protected]>

* Changed request per second to Float

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed string array for source indices and removed state index entry

Signed-off-by: owaiskazi19 <[email protected]>

* Minor comments

Signed-off-by: owaiskazi19 <[email protected]>

---------

Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: martinpkr <[email protected]>

* Incorporating parseIfExist method into ReindexStep class

Signed-off-by: martinpkr <[email protected]>

* Add param to delete workflow API to clear status even if resources exist (#719)

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: martinpkr <[email protected]>

* refactored method to use parseBoolean and parseFloat methods

Signed-off-by: martinpkr <[email protected]>

* Adding a missing param in javaDoc

Signed-off-by: martinpkr <[email protected]>

* Added workflow step for ReIndex Step (#718)

* Initial commit for reindex workflow step with extra params

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed PR comments

Signed-off-by: owaiskazi19 <[email protected]>

* Changed request per second to Float

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed string array for source indices and removed state index entry

Signed-off-by: owaiskazi19 <[email protected]>

* Minor comments

Signed-off-by: owaiskazi19 <[email protected]>

---------

Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: martinpkr <[email protected]>

* Add param to delete workflow API to clear status even if resources exist (#719)

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: martinpkr <[email protected]>

* Added a chagelog entry

Signed-off-by: martinpkr <[email protected]>

* fixed failing spotless check

Signed-off-by: martinpkr <[email protected]>

* Added workflow step for ReIndex Step (#718)

* Initial commit for reindex workflow step with extra params

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed PR comments

Signed-off-by: owaiskazi19 <[email protected]>

* Changed request per second to Float

Signed-off-by: owaiskazi19 <[email protected]>

* Addressed string array for source indices and removed state index entry

Signed-off-by: owaiskazi19 <[email protected]>

* Minor comments

Signed-off-by: owaiskazi19 <[email protected]>

---------

Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: martinpkr <[email protected]>

* removed unnecessary changelog info

Signed-off-by: martinpkr <[email protected]>

---------

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: martinpkr <[email protected]>
Signed-off-by: owaiskazi19 <[email protected]>
Co-authored-by: Daniel Widdis <[email protected]>
Co-authored-by: Owais Kazi <[email protected]>
(cherry picked from commit 13b32f1)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
owaiskazi19 added a commit that referenced this pull request Jun 3, 2024
…factored code with new method (#728)

Added a new parse util method to avoid repetition / refactored code with new method (#721)

* Add user mapping to Workflow State index (#705)

* Add user mapping to Workflow State index



* Increment schema version



---------




* Added a new parse util method to avoid repetition / refactored code with new method



* refactored method name and added unit test



* made method use generics + added test



* fixed javadoc



* Added workflow step for ReIndex Step (#718)

* Initial commit for reindex workflow step with extra params



* Addressed PR comments



* Changed request per second to Float



* Addressed string array for source indices and removed state index entry



* Minor comments



---------




* Incorporating parseIfExist method into ReindexStep class



* Add param to delete workflow API to clear status even if resources exist (#719)




* refactored method to use parseBoolean and parseFloat methods



* Adding a missing param in javaDoc



* Added workflow step for ReIndex Step (#718)

* Initial commit for reindex workflow step with extra params



* Addressed PR comments



* Changed request per second to Float



* Addressed string array for source indices and removed state index entry



* Minor comments



---------




* Add param to delete workflow API to clear status even if resources exist (#719)




* Added a chagelog entry



* fixed failing spotless check



* Added workflow step for ReIndex Step (#718)

* Initial commit for reindex workflow step with extra params



* Addressed PR comments



* Changed request per second to Float



* Addressed string array for source indices and removed state index entry



* Minor comments



---------




* removed unnecessary changelog info



---------






(cherry picked from commit 13b32f1)

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: martinpkr <[email protected]>
Signed-off-by: owaiskazi19 <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Daniel Widdis <[email protected]>
Co-authored-by: Owais Kazi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport PRs to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Create a new Util method for a common pattern
3 participants