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

Combine create api with provision api by adding a provision param #282

Merged

Conversation

jackiehanyang
Copy link
Collaborator

Description

Combine create api with provision api by adding a provision=true parameter to create api

Issues Resolved

#259

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.

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
@amitgalitz
Copy link
Member

Do we not have a dry_run optional param at all anymore?

@jackiehanyang
Copy link
Collaborator Author

Do we not have a dry_run optional param at all anymore?

What's the benefit of keeping the dry_run parameter? provision covers all the check dry_run does. Also as this project is not launched yet, this is not a breaking change.

@joshpalis
Copy link
Member

What's the benefit of keeping the dry_run parameter? provision covers all the check dry_run does. Also as this project is not launched yet, this is not a breaking change.

Dry run param in the create workflow API should remain unchanged. This is to allow for validation prior to saving into the global context index. Combining the two APIs together should just add a new path rather than supersede existing ones.

Though provision does validate as well, since we're combining the two it would make sense to validate on create (before we index) rather than after. I would suggest we invoke the CreateWorkflowTransportAction with a dry-run flag set to true and then provision via ProvisionWorkflowTransportAction

@jackiehanyang
Copy link
Collaborator Author

What's the benefit of keeping the dry_run parameter? provision covers all the check dry_run does. Also as this project is not launched yet, this is not a breaking change.

Dry run param in the create workflow API should remain unchanged. This is to allow for validation prior to saving into the global context index. Combining the two APIs together should just add a new path rather than supersede existing ones.

Though provision does validate as well, since we're combining the two it would make sense to validate on create (before we index) rather than after. I would suggest we invoke the CreateWorkflowTransportAction with a dry-run flag set to true and then provision via ProvisionWorkflowTransportAction

Are you suggesting when provision=true we treat it like dryrun=true && provision=true?

@joshpalis
Copy link
Member

joshpalis commented Dec 13, 2023

Are you suggesting when provision=true we treat it like dryrun=true && provision=true?

Yes

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
Signed-off-by: Jackie Han <jkhanjob@gmail.com>
@dbwiddis
Copy link
Member

dbwiddis commented Dec 13, 2023

Are you suggesting when provision=true we treat it like dryrun=true && provision=true?

Yes

I may be misunderstanding dryrun or maybe it's poorly named.

Dry run usually means do validation checks but don't actually index anything. So my thoughts would be:

  • dryRun false, provision false = validates and saves to index, does not provision <-- normal 2-step case front-end will use
  • dryRun false, provision true = validates and saves to index, then provisions <-- normal use case for a debugged workflow for one-click
  • dryRun true, provision false = validates but doesn't save anything <-- kinda like precommit checks :)
  • dryRun true, provision true = illegal

Does it mean something else than that?

@joshpalis
Copy link
Member

Dry run usually means do validation checks but don't actually index anything.

@dbwiddis currently when we dry-run, if the template passes validation, then we index, if not then we return an error

@jackiehanyang
Copy link
Collaborator Author

jackiehanyang commented Dec 13, 2023

Are you suggesting when provision=true we treat it like dryrun=true && provision=true?

Yes

I may be misunderstanding dryrun or maybe it's poorly named.

Dry run usually means do validation checks but don't actually index anything. So my thoughts would be:

  • dryRun false, provision false = validates and saves to index, does not provision <-- normal 2-step case front-end will use
  • dryRun false, provision true = validates and saves to index, then provisions <-- normal use case for a debugged workflow for one-click
  • dryRun true, provision false = validates but doesn't save anything <-- kinda like precommit checks :)
  • dryRun true, provision true = illegal

Does it mean something else than that?

My understanding of all the conditions is:

  • dryRun=false && provision=false, no formate validation, no provision. Just save the template to index
  • dryRun=false && provision=true, save the template to index, then provisioning the template. Provision could failed due to template formatting error like missing certain input files, or could due to template is a cyclic graph. (it just performs all the check that come with the Provision API)
  • dryRun=true && provision = false, do formate validation first, only save the template to index if it passes the check.
  • dryRun=true && provision = true, do formate validation first, save the template to index if it passes the check, then provisioning the template. Although provision step also checks for formatting issues, which is already covered by dryRun check.

I think no matter how customer mix&match these two parameters, they should all be legal. The dryRun=true && provision = true case helps customer to fail early is there's any formatting issue

PROPOSAL: We retain both the dryRun and provision parameters, allowing customers to mix and match them as they wish.

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
@joshpalis
Copy link
Member

My understanding of all the conditions is:

dryRun=false && provision=false, no formate validation, no provision. Just save the template to index
dryRun=false && provision=true, save the template to index, then provisioning the template. Provision could failed due to template formatting error like missing certain input files, or could due to template is a cyclic graph. (it just performs all the check that come with the Provision API)
dryRun=true && provision = false, do formate validation first, only save the template to index if it passes the check.
dryRun=true && provision = true, do formate validation first, save the template to index if it passes the check, then provisioning the template. Although provision step also checks for formatting issues, which is already covered by dryRun check.
I think no matter how customer mix&match these two parameters, they should all be legal. The dryRun=true && provision = true case helps customer to fail early is there's any formatting issue

PROPOSAL: We retain both the dryRun and provision parameters, allowing customers to mix and match them as they wish.

Agreed with this proposal

@dbwiddis
Copy link
Member

My understanding of all the conditions is:
dryRun=false && provision=false, no formate validation, no provision. Just save the template to index
dryRun=false && provision=true, save the template to index, then provisioning the template. Provision could failed due to template formatting error like missing certain input files, or could due to template is a cyclic graph. (it just performs all the check that come with the Provision API)
dryRun=true && provision = false, do formate validation first, only save the template to index if it passes the check.
dryRun=true && provision = true, do formate validation first, save the template to index if it passes the check, then provisioning the template. Although provision step also checks for formatting issues, which is already covered by dryRun check.
I think no matter how customer mix&match these two parameters, they should all be legal. The dryRun=true && provision = true case helps customer to fail early is there's any formatting issue
PROPOSAL: We retain both the dryRun and provision parameters, allowing customers to mix and match them as they wish.

Agreed with this proposal

I'm ok with this except that it doesn't match my understanding of the term "dryRun". For example in AD the "create detector" with dryRun does not actually create a detector (actually it's just a variable but it corresponds to validating).

So if we're going this way let's use "validate" rather than dry run.

https://en.wikipedia.org/wiki/Dry_run_(testing)

@dbwiddis
Copy link
Member

Other opensearch use of dryrun: https://opensearch.org/docs/latest/observing-your-data/alerting/api/

You can add the optional ?dryrun=true parameter to the URL to show the results of a run without actions sending any message.

Use of validate: https://opensearch.org/docs/latest/observing-your-data/ad/api/

Returns whether the detector configuration has any issues that might prevent OpenSearch from creating the detector.

You can use the validate detector API operation to identify issues in your detector configuration before creating the detector.

Use of validate: https://opensearch.org/docs/latest/im-plugin/ism/error-prevention/api/

Pass the validate_action=true path parameter in the Explain API URI to see the validation status and message.

@jackiehanyang
Copy link
Collaborator Author

My understanding of all the conditions is:
dryRun=false && provision=false, no formate validation, no provision. Just save the template to index
dryRun=false && provision=true, save the template to index, then provisioning the template. Provision could failed due to template formatting error like missing certain input files, or could due to template is a cyclic graph. (it just performs all the check that come with the Provision API)
dryRun=true && provision = false, do formate validation first, only save the template to index if it passes the check.
dryRun=true && provision = true, do formate validation first, save the template to index if it passes the check, then provisioning the template. Although provision step also checks for formatting issues, which is already covered by dryRun check.
I think no matter how customer mix&match these two parameters, they should all be legal. The dryRun=true && provision = true case helps customer to fail early is there's any formatting issue
PROPOSAL: We retain both the dryRun and provision parameters, allowing customers to mix and match them as they wish.

Agreed with this proposal

I'm ok with this except that it doesn't match my understanding of the term "dryRun". For example in AD the "create detector" with dryRun does not actually create a detector (actually it's just a variable but it corresponds to validating).

So if we're going this way let's use "validate" rather than dry run.

https://en.wikipedia.org/wiki/Dry_run_(testing)

When dryRun is set to true, we proceed with indexing only if it passes the validation check - this is the current design of the create workflow API. If we think it's necessary to revise the design of the create workflow API, I can open a separate issue for this matter.

@dbwiddis
Copy link
Member

When dryRun is set to true, we proceed with indexing only if it passes the validation check

I'm fine with this, I'm just quibbling over using the term "dryRun" (used only once in the opensearch API) vs. "validate" used many times and much more clear on what's happening.

@jackiehanyang
Copy link
Collaborator Author

When dryRun is set to true, we proceed with indexing only if it passes the validation check

I'm fine with this, I'm just quibbling over using the term "dryRun" (used only once in the opensearch API) vs. "validate" used many times and much more clear on what's happening.

Let's the continue the discussion in this issue - #291

Copy link
Member

@amitgalitz amitgalitz left a comment

Choose a reason for hiding this comment

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

LGTM, one very minor comment only

@jackiehanyang jackiehanyang merged commit 68817bf into opensearch-project:feature/agent_framework Dec 14, 2023
10 checks passed
dbwiddis pushed a commit to dbwiddis/flow-framework that referenced this pull request Dec 15, 2023
…ensearch-project#282)

* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
dbwiddis pushed a commit to dbwiddis/flow-framework that referenced this pull request Dec 15, 2023
…ensearch-project#282)

* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
dbwiddis pushed a commit to dbwiddis/flow-framework that referenced this pull request Dec 15, 2023
…ensearch-project#282)

* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
dbwiddis pushed a commit to dbwiddis/flow-framework that referenced this pull request Dec 15, 2023
…ensearch-project#282)

* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
dbwiddis pushed a commit that referenced this pull request Dec 18, 2023
* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
dbwiddis pushed a commit to dbwiddis/flow-framework that referenced this pull request Dec 18, 2023
…ensearch-project#282)

* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
dbwiddis pushed a commit that referenced this pull request Dec 18, 2023
* replace dryrun parameter with provision in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* test

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* Combine create api with provision api by adding a provision param

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep dryrun option in create workflow

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* cleanup

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* keep both dryRun and provision parameter

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
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