|
|
|
@@ -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 |
|
|
|
} |
|
|
|
|