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

Archive Cancelled Workflows #939

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beeflow/tests/test_wf_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def test_cancel_workflow(client, mocker, setup_teardown_workflow, temp_db):

request = {'wf_id': WF_ID, 'option': 'cancel'}
resp = client().delete(f'/bee_wfm/v1/jobs/{WF_ID}', json=request)
assert resp.json['status'] == 'Cancelled'
assert resp.json['status'] == 'Cancelled and Archived'
assert resp.status_code == 202


Expand Down
5 changes: 4 additions & 1 deletion beeflow/wf_manager/resources/wf_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from flask_restful import Resource, reqparse
from beeflow.common import log as bee_logging
from beeflow.wf_manager.resources import wf_utils
from beeflow.wf_manager.resources.wf_update import archive_workflow

from beeflow.common.db import wfm_db
from beeflow.common.db.bdb import connect_db
Expand Down Expand Up @@ -64,7 +65,9 @@ def delete(self, wf_id):
wf_utils.update_wf_status(wf_id, 'Cancelled')
db.workflows.update_workflow_state(wf_id, 'Cancelled')
log.info(f"Workflow {wf_id} cancelled")
resp = make_response(jsonify(status='Cancelled'), 202)
# Archive cancelled workflow
archive_workflow(db, wf_id, final_state='Cancelled')
resp = make_response(jsonify(status='Cancelled and Archived'), 202)
elif option == "remove":
log.info(f"Removing workflow {wf_id}.")
db.workflows.delete_workflow(wf_id)
Expand Down
Loading