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

Adding new exception type for workflow step failures #577

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

amitgalitz
Copy link
Member

Description

Adds a new exception type to differentiate between errors that are due to flow-framework's fault during provisioning vs errors that are due to the downstream plugin's faults.

Also fixed error handling on deprovision:
previously if we gave a payload to the deprovision request we got a 500 error of Channel is already closed

The two error types:

"error": "org.opensearch.flowframework.exception.WorkflowStepException during step create_ingest_pipeline, restStatus: BAD_REQUEST"
"error": "org.opensearch.flowframework.exception.WorkflowStepException during step create_ingest_pipeline, restStatus: BAD_REQUEST"

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

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 45.16129% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 72.75%. Comparing base (eab5ab6) to head (e5ab7c3).

Files Patch % Lines
...flowframework/exception/WorkflowStepException.java 25.00% 6 Missing ⚠️
...rk/transport/ProvisionWorkflowTransportAction.java 0.00% 4 Missing ⚠️
...h/flowframework/rest/RestCreateWorkflowAction.java 0.00% 1 Missing ⚠️
...h/flowframework/rest/RestDeleteWorkflowAction.java 0.00% 1 Missing ⚠️
...wframework/rest/RestDeprovisionWorkflowAction.java 50.00% 1 Missing ⚠️
...flowframework/rest/RestGetWorkflowStateAction.java 0.00% 1 Missing ⚠️
.../flowframework/rest/RestGetWorkflowStepAction.java 0.00% 1 Missing ⚠️
...lowframework/rest/RestProvisionWorkflowAction.java 0.00% 1 Missing ⚠️
...mework/workflow/AbstractRetryableWorkflowStep.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #577      +/-   ##
============================================
- Coverage     72.95%   72.75%   -0.20%     
- Complexity      680      681       +1     
============================================
  Files            81       82       +1     
  Lines          3479     3491      +12     
  Branches        278      279       +1     
============================================
+ Hits           2538     2540       +2     
- Misses          822      832      +10     
  Partials        119      119              

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

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.

Tests are not failing currently because WorkflowStepException extendsFlowFrameworkException but we should change the rest test cases to check for WorkflowStepException.

@amitgalitz
Copy link
Member Author

Tests are not failing currently because WorkflowStepException extendsFlowFrameworkException but we should change the rest test cases to check for WorkflowStepException.

Actually there is another reason for this also, that makes me debate if we even need this here. We actually don't return the WorkflowStepException in the rest here ever because we just write it to the error field in the index if it happens during the step. User gets the workflow ID back

@amitgalitz
Copy link
Member Author

Tests are not failing currently because WorkflowStepException extendsFlowFrameworkException but we should change the rest test cases to check for WorkflowStepException.

Actually there is another reason for this also, that makes me debate if we even need this here. We actually don't return the WorkflowStepException in the rest here ever because we just write it to the error field in the index if it happens during the step. User gets the workflow ID back

@joshpalis lmk if you have any opposition to just adding the WorkflowStepException and not changing the rest classes due to above reason

@joshpalis
Copy link
Member

@joshpalis lmk if you have any opposition to just adding the WorkflowStepException and not changing the rest classes due to above reason

No concerns, looks good to me

@amitgalitz amitgalitz merged commit 0f39629 into opensearch-project:main Mar 19, 2024
30 of 32 checks passed
@opensearch-trigger-bot
Copy link

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/flow-framework/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/flow-framework/backport-2.x
# Create a new branch
git switch --create backport/backport-577-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0f3962974188ac6ff9202c32d0827bdea33636b9
# Push it to GitHub
git push --set-upstream origin backport/backport-577-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/flow-framework/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-577-to-2.x.

amitgalitz added a commit to amitgalitz/opensearch-ai-flow-framework that referenced this pull request Mar 19, 2024
…ect#577)

* new exception type for workflow step failures

Signed-off-by: Amit Galitzky <[email protected]>

* reverting change on rest classes

Signed-off-by: Amit Galitzky <[email protected]>

* adding integ tests for new exception written to state index

Signed-off-by: Amit Galitzky <[email protected]>

---------

Signed-off-by: Amit Galitzky <[email protected]>
@amitgalitz amitgalitz mentioned this pull request Mar 19, 2024
joshpalis pushed a commit that referenced this pull request Mar 19, 2024
Adding new exception type for workflow step failures (#577)

* new exception type for workflow step failures



* reverting change on rest classes



* adding integ tests for new exception written to state index



---------

Signed-off-by: Amit Galitzky <[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.

3 participants