(get)
| 684 | |
| 685 | @staticmethod |
| 686 | def remove_flow(get): |
| 687 | flow_ids = list_args(get,"flow_ids") |
| 688 | if not flow_ids: |
| 689 | return json_response(status=False, msg="请选择要删除的任务") |
| 690 | fdb = TaskFlowsDB() |
| 691 | flows = fdb.Flow.query( |
| 692 | "id IN (%s) AND status NOT IN (?, ?)" % (",".join(["?"]*len(flow_ids))), |
| 693 | (*flow_ids, "waiting", "running") |
| 694 | ) |
| 695 | |
| 696 | command_tasks = fdb.CommandTask.query( |
| 697 | "flow_id IN (%s)" % (",".join(["?"]*len(flow_ids))), |
| 698 | (*flow_ids,) |
| 699 | ) |
| 700 | |
| 701 | command_logs = fdb.CommandLog.query( |
| 702 | "command_task_id IN (%s)" % (",".join(["?"]*len(flow_ids))), |
| 703 | (*flow_ids,) |
| 704 | ) |
| 705 | |
| 706 | for log in command_logs: |
| 707 | try: |
| 708 | if os.path.exists(log.log_file): |
| 709 | os.remove(log.log_file) |
| 710 | except: |
| 711 | pass |
| 712 | |
| 713 | fdb.CommandLog.delete([log.id for log in command_logs]) |
| 714 | fdb.CommandTask.delete([task.id for task in command_tasks]) |
| 715 | fdb.Flow.delete([flow.id for flow in flows]) |
| 716 | |
| 717 | w, p = "flow_id IN (%s)" % (",".join(["?"]*len(flow_ids))), (*flow_ids,) |
| 718 | fdb.TransferTask.delete_where(w, p) |
| 719 | fdb.TransferLog.delete_where(w, p) |
| 720 | fdb.TransferFile.delete_where(w, p) |
| 721 | |
| 722 | return json_response(status=True, msg="删除成功") |
| 723 | |
| 724 | def retry_flow(self, get): |
| 725 | ws: simple_websocket.Server = getattr(get, '_ws', None) |
nothing calls this directly
no test coverage detected