-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support editing of certain workflow fields on a provisioned workflow #757
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #757 +/- ##
============================================
+ Coverage 74.37% 74.61% +0.24%
- Complexity 745 783 +38
============================================
Files 84 84
Lines 3825 3873 +48
Branches 333 356 +23
============================================
+ Hits 2845 2890 +45
Misses 825 825
- Partials 155 158 +3 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Daniel Widdis <[email protected]>
POST localhost:9200/_plugins/_flow_framework/workflow?provision=true
{
"name": "test",
"description": "Flow template",
"use_case": "TESTING",
"version": {
"template": "1.0.0",
"compatibility": ["2.12.0", "3.0.0"]
},
"workflows": {
"provision": {
"user_params": {},
"nodes": [
{
"id": "no op",
"type": "noop"
}
]
}
}
} {
"workflow_id": "yl5IfJABgzSGdpsYUKJE"
} GET localhost:9200/_plugins/_flow_framework/workflow/yl5IfJABgzSGdpsYUKJE {
"name": "test",
"description": "Flow template",
"use_case": "TESTING",
"version": {
"template": "1.0.0",
"compatibility": [
"2.12.0",
"3.0.0"
]
},
"workflows": {
"provision": {
"user_params": {},
"nodes": [
{
"id": "no op",
"type": "noop",
"previous_node_inputs": {},
"user_inputs": {}
}
],
"edges": []
}
},
"created_time": 1720072032206,
"last_updated_time": 1720072032206,
"last_provisioned_time": 1720072032727
} GET localhost:9200/_plugins/_flow_framework/workflow/yl5IfJABgzSGdpsYUKJE/_status {
"workflow_id": "yl5IfJABgzSGdpsYUKJE",
"state": "COMPLETED"
} PUT localhost:9200/_plugins/_flow_framework/workflow/yl5IfJABgzSGdpsYUKJE
{
"name": "a test with no name",
"description": "Updated flow template",
"use_case": "TESTING",
"version": {
"template": "1.0.0",
"compatibility": ["2.12.0", "3.0.0"]
},
"workflows": {
"provision": {
"user_params": {},
"nodes": [
{
"id": "no op",
"type": "noop"
}
]
}
}
} 400 Bad Request
{
"error": "The template can not be updated unless its provisioning state is NOT_STARTED: yl5IfJABgzSGdpsYUKJE. Deprovision the workflow to reset the state."
} PUT localhost:9200/_plugins/_flow_framework/workflow/yl5IfJABgzSGdpsYUKJE?update_fields=true
{
"workflows": {
"provision": {
"user_params": {},
"nodes": [
{
"id": "no op",
"type": "noop"
}
]
}
}
} 400 Bad Request
{
"error": "You can not update the field [workflows] without updating the whole template."
} PUT localhost:9200/_plugins/_flow_framework/workflow/yl5IfJABgzSGdpsYUKJE?update_fields=true
{
"name": "a test with no name",
"description": "Updated flow template"
} {
"workflow_id": "yl5IfJABgzSGdpsYUKJE"
} GET localhost:9200/_plugins/_flow_framework/workflow/yl5IfJABgzSGdpsYUKJE {
"name": "a test with no name",
"description": "Updated flow template",
"use_case": "TESTING",
"version": {
"template": "1.0.0",
"compatibility": [
"2.12.0",
"3.0.0"
]
},
"workflows": {
"provision": {
"user_params": {},
"nodes": [
{
"id": "no op",
"type": "noop",
"previous_node_inputs": {},
"user_inputs": {}
}
],
"edges": []
}
},
"created_time": 1720072032206,
"last_updated_time": 1720077009607,
"last_provisioned_time": 1720072032727
} |
Failing CI tracked in |
Signed-off-by: Daniel Widdis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for adding this. The allowlisted fields should be sufficient for the frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall with minor suggestions
src/main/java/org/opensearch/flowframework/transport/CreateWorkflowTransportAction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: Daniel Widdis <[email protected]>
d067272
to
d6510ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the comments. LGTM!
Tests failing on WIndows because clock resolution isn't sufficient to guarantee "instant" increments. :| |
Signed-off-by: Daniel Widdis <[email protected]>
…757) * Support editing of certain workflow fields on a provisioned workflow Signed-off-by: Daniel Widdis <[email protected]> * Add integ test Signed-off-by: Daniel Widdis <[email protected]> * Address review comments Signed-off-by: Daniel Widdis <[email protected]> * Refactor field update method to Template class Signed-off-by: Daniel Widdis <[email protected]> * Update tests to ensure update timestamp increments Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]> (cherry picked from commit 7d45f92) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ioned workflow (#775) Support editing of certain workflow fields on a provisioned workflow (#757) * Support editing of certain workflow fields on a provisioned workflow * Add integ test * Address review comments * Refactor field update method to Template class * Update tests to ensure update timestamp increments --------- (cherry picked from commit 7d45f92) Signed-off-by: Daniel Widdis <[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>
Description
Allows passing the parameter
update_fields=true
on the REST path when updating a template (PUT). This will update the existing template with only the included fields.Issues Resolved
Resolves #749
Documentation
Please review:
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.