MCPcopy Create free account
hub / github.com/C3ting/ARL / post

Method post

app/routes/github_task.py:85–105  ·  view source on GitHub ↗

Github 任务删除

(self)

Source from the content-addressed store, hash-verified

83 @auth
84 @ns.expect(delete_github_task_fields)
85 def post(self):
86 """
87 Github 任务删除
88 """
89 done_status = [TaskStatus.DONE, TaskStatus.STOP, TaskStatus.ERROR]
90 args = self.parse_args(delete_github_task_fields)
91 task_id_list = args.pop('_id')
92
93 for task_id in task_id_list:
94 task_data = utils.conn_db('github_task').find_one({'_id': ObjectId(task_id)})
95 if not task_data:
96 return utils.build_ret(ErrorMsg.NotFoundTask, {"_id": task_id})
97
98 if task_data["status"] not in done_status:
99 return utils.build_ret(ErrorMsg.TaskIsRunning, {"_id": task_id})
100
101 for task_id in task_id_list:
102 utils.conn_db('github_task').delete_one({'_id': ObjectId(task_id)})
103 utils.conn_db('github_result').delete_many({'github_task_id': task_id})
104
105 return utils.build_ret(ErrorMsg.Success, {"_id": task_id_list})
106
107
108stop_github_task_fields = ns.model('StopGithubTask', {

Callers

nothing calls this directly

Calls 1

parse_argsMethod · 0.80

Tested by

no test coverage detected