-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Workflow] workflow.delete #19178
[Workflow] workflow.delete #19178
Conversation
cc @lchu-ibm we'll probably want to add |
workflow.resume("finishes") | ||
|
||
# Deleting is idempotent. | ||
workflow.delete(workflow_id="finishes") |
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.
We should throw JobNotFound error
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.
This doesn't exist yet right?
Also nit: let's call it WorkflowNotFoundError
?
@@ -125,7 +125,9 @@ def get_status(workflow_id: str) -> Optional[WorkflowStatus]: | |||
store = workflow_storage.get_workflow_storage(workflow_id) | |||
meta = store.load_workflow_meta() | |||
if meta is None: | |||
raise ValueError(f"No such workflow_id {workflow_id}") | |||
raise WorkflowNotFoundError(workflow_id) | |||
if meta.status == WorkflowStatus.RUNNING: |
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.
Seems like a necessary fix, tested in test_recovery
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.
Good catch!
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.
Reviewed 3 of 7 files at r1, 3 of 5 files at r2, 2 of 6 files at r4, 1 of 1 files at r5.
Reviewable status: 7 of 10 files reviewed, 10 unresolved discussions (waiting on @iycheng and @wuisawesome)
python/ray/workflow/api.py, line 368 at r5 (raw file):
print("STATUS:", status)
delete print
python/ray/workflow/workflow_storage.py, line 451 at r3 (raw file):
scan = [] scan_future = self._storage.scan_prefix(prefix)
should we just check exists first and then delete it?
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.
Reviewable status: 7 of 10 files reviewed, 11 unresolved discussions (waiting on @iycheng and @wuisawesome)
python/ray/workflow/tests/test_recovery.py, line 171 at r5 (raw file):
simple.step("x").run(workflow_id=workflow_id) assert workflow.get_status(
good catch
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.
Overall it looks good. I tried reviewable and it looks awful :( Please ignore any wired comments.
@@ -125,7 +125,9 @@ def get_status(workflow_id: str) -> Optional[WorkflowStatus]: | |||
store = workflow_storage.get_workflow_storage(workflow_id) | |||
meta = store.load_workflow_meta() | |||
if meta is None: | |||
raise ValueError(f"No such workflow_id {workflow_id}") | |||
raise WorkflowNotFoundError(workflow_id) | |||
if meta.status == WorkflowStatus.RUNNING: |
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.
Good catch!
scan = [] | ||
scan_future = self._storage.scan_prefix(prefix) | ||
delete_future = self._storage.delete_prefix(prefix) |
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.
should we just check exists and delete it? (https://sourcegraph.com/github.com/ray-project/ray/-/blob/python/ray/workflow/workflow_storage.py?L375) ?
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.
Synced offline. We need scan_prefix a generator kind of thing for efficiency which can be done later. (#19234)
workflow tests passed and docs look fine in the preview. merging. |
* Revert "Revert "[Workflow] workflow.delete (#19178)" (#19247)" This reverts commit b593175. * fix * . * . * . * Revert "." This reverts commit 423b9b8. * . * . * done? * 4real Co-authored-by: Alex <[email protected]>
Why are these changes needed?
This PR implements
workflow.delete
which allows users to delete the information in storage related to a workflow. (This assumes the workflow isn't currently running).Related issue number
Closes #18848
Checks
scripts/format.sh
to lint the changes in this PR.This change is