Browse Source

提交代码,解决停止任务的Bug

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.10.1^2
zouap 3 years ago
parent
commit
e3dbc2586e
1 changed files with 1 additions and 5 deletions
  1. +1
    -5
      routers/repo/aisafety.go

+ 1
- 5
routers/repo/aisafety.go View File

@@ -201,17 +201,14 @@ func StopAiSafetyTask(ctx *context.Context) {
func DelAiSafetyTask(ctx *context.Context) {
var ID = ctx.Params(":jobid")
task, err := models.GetCloudbrainByIDWithDeleted(ID)
result := make(map[string]interface{})
result["code"] = 1

if err != nil {
log.Error("GetCloudbrainByJobID failed:" + err.Error())
result["msg"] = "No such task."
ctx.ServerError("No such task.", err)
return
}
if task.Status != string(models.JobStopped) && task.Status != string(models.JobFailed) && task.Status != string(models.JobSucceeded) {
log.Error("the job(%s) has not been stopped", task.JobName, ctx.Data["msgID"])
result["msg"] = "the job(" + task.JobName + ") has not been stopped"
ctx.ServerError("the job("+task.JobName+") has not been stopped", nil)
return
}
@@ -220,7 +217,6 @@ func DelAiSafetyTask(ctx *context.Context) {
}
err = models.DeleteJob(task)
if err != nil {
result["msg"] = err.Error()
ctx.ServerError(err.Error(), err)
return
}


Loading…
Cancel
Save