MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / remove_flow

Method remove_flow

mod/project/node/executorMod.py:686–722  ·  view source on GitHub ↗
(get)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 9

list_argsFunction · 0.90
json_responseFunction · 0.90
TaskFlowsDBClass · 0.90
delete_whereMethod · 0.80
queryMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected