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

Pipeline Configuration Transformation #4446

Merged
merged 24 commits into from
Apr 25, 2024

Conversation

srikanthjg
Copy link
Contributor

@srikanthjg srikanthjg commented Apr 19, 2024

Description

Support pipeline configuration transformation based on rules and templates.

Rules for a transformation will be defined in a yaml file. It will be checked for every pipeline. If rules apply, a corresponding template is chosen. The template defines the transformation for that pipeline. Currently if there are multiple sub-pipelines, only one pipeline is chosen for which the rules apply.

Template definitions uses JsonPath to index nodes in the user provided configuration.

Current Assumptions:

  1. In the template definition, Deep scan or recursive expressions like$.. is NOT supported. Always use a more specific expression. In the event specific variables in a path are not known, use wildcards.
  2. User could provide multiple pipelines in their user config but there can be only one pipeline that can support transformation.
  3. There cannot be multiple transformations in a single pipeline.
  4. << .. >> is the placeholder in the template.
    <<pipeline-name>> is handled differently as compared to other placeholders
    as other placeholders are jsonPaths, this just replaces placeholder with the pipeline Name that needs transformation.

Issues Resolved

Resolves #4444

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

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.

@@ -0,0 +1,69 @@
"{{pipeline-name}}-writer":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This template is not the final version, needs to be finalized. Check the test/resources/templates/testSource for the templates i used to test

Copy link

Choose a reason for hiding this comment

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

acknowledgments: false -> This should be true.

* @return RuleEvaluatorResult
*/
private RuleEvaluatorResult isDocDBSource(PipelinesDataFlowModel pipelinesModel) {
PLUGIN_NAME = "documentdb";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only a temporary implementation, will move towards scanning folder and fetching and applying rule file dynamically.

Copy link
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

I made some high-level comments. I'll also try to dive into some lower-level details later.

kkondaka
kkondaka previously approved these changes Apr 23, 2024
import java.util.List;

@Data
public class RuleTransformerModel {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be RuleTransformerModelConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can address this nitpick in the subsequent pr.

* @param json
* @return Map<String, List<String>> , K:placeholder, V: list of jsonPath in templateJson
* @throws IOException
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably good idea to document example input args and expected output which helps in understanding the code better. (This comment is for all functions in this file)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can address this nitpick in the subsequent pr.

@kkondaka kkondaka dismissed their stale review April 23, 2024 01:31

left few comments to be addressed

Copy link
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

@srikanthjg , Your DCO is failing. You have some commits from a merge in here. Please use a rebase from main instead.

Other than that, this should be good to merge. I think the rest of the changes will now be internal to the transformation code.

@dlvenable
Copy link
Member

Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
…cDB with big template

Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
templates and rules

Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Signed-off-by: srigovs <srigovs@amazon.com>
Copy link
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for this significant contribution!

@kkondaka kkondaka merged commit e590fde into opensearch-project:main Apr 25, 2024
47 checks passed
@kkondaka kkondaka added this to the v2.8 milestone May 14, 2024
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.

Pipeline Configuration Transformation
4 participants