Skip to content

Commit

Permalink
Revert cancel refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nazywam authored and psrok1 committed Jun 20, 2023
1 parent f1a8d5b commit 048be00
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions karton/dashboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class KartonDashboard(KartonBase):
)


def cancel_tasks(tasks: List[Task]) -> None:
for task in tasks:
karton.backend.set_task_status(task=task, status=TaskState.FINISHED)


class TaskView:
"""
All problems in computer science can be solved by another
Expand Down Expand Up @@ -276,7 +281,7 @@ def cancel_crashed_queue_tasks(queue_name):
if not queue:
return jsonify({"error": "Queue doesn't exist"}), 404

karton.backend.delete_tasks(queue.crashed_tasks)
cancel_tasks(queue.crashed_tasks)
return redirect(request.referrer)


Expand All @@ -287,7 +292,7 @@ def cancel_pending_queue_tasks(queue_name):
if not queue:
return jsonify({"error": "Queue doesn't exist"}), 404

karton.backend.delete_tasks(queue.pending_tasks)
cancel_tasks(queue.pending_tasks)
return redirect(request.referrer)


Expand All @@ -307,7 +312,7 @@ def cancel_task(task_id):
if not task:
return jsonify({"error": "Task doesn't exist"}), 404

karton.backend.delete_tasks([task])
cancel_tasks([task])
return redirect(request.referrer)


Expand Down

0 comments on commit 048be00

Please sign in to comment.