| @@ -201,17 +201,14 @@ func StopAiSafetyTask(ctx *context.Context) { | |||||
| func DelAiSafetyTask(ctx *context.Context) { | func DelAiSafetyTask(ctx *context.Context) { | ||||
| var ID = ctx.Params(":jobid") | var ID = ctx.Params(":jobid") | ||||
| task, err := models.GetCloudbrainByIDWithDeleted(ID) | task, err := models.GetCloudbrainByIDWithDeleted(ID) | ||||
| result := make(map[string]interface{}) | |||||
| result["code"] = 1 | |||||
| if err != nil { | if err != nil { | ||||
| log.Error("GetCloudbrainByJobID failed:" + err.Error()) | log.Error("GetCloudbrainByJobID failed:" + err.Error()) | ||||
| result["msg"] = "No such task." | |||||
| ctx.ServerError("No such task.", err) | ctx.ServerError("No such task.", err) | ||||
| return | return | ||||
| } | } | ||||
| if task.Status != string(models.JobStopped) && task.Status != string(models.JobFailed) && task.Status != string(models.JobSucceeded) { | 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"]) | 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) | ctx.ServerError("the job("+task.JobName+") has not been stopped", nil) | ||||
| return | return | ||||
| } | } | ||||
| @@ -220,7 +217,6 @@ func DelAiSafetyTask(ctx *context.Context) { | |||||
| } | } | ||||
| err = models.DeleteJob(task) | err = models.DeleteJob(task) | ||||
| if err != nil { | if err != nil { | ||||
| result["msg"] = err.Error() | |||||
| ctx.ServerError(err.Error(), err) | ctx.ServerError(err.Error(), err) | ||||
| return | return | ||||
| } | } | ||||