| @@ -192,11 +192,6 @@ func NotebookShow(ctx *context.Context) { | |||||
| func NotebookDebug(ctx *context.Context) { | func NotebookDebug(ctx *context.Context) { | ||||
| var jobID = ctx.Params(":jobid") | var jobID = ctx.Params(":jobid") | ||||
| _, err := models.GetCloudbrainByJobID(jobID) | |||||
| if err != nil { | |||||
| ctx.ServerError("GetCloudbrainByJobID failed", err) | |||||
| return | |||||
| } | |||||
| result, err := modelarts.GetJob(jobID) | result, err := modelarts.GetJob(jobID) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -325,11 +320,7 @@ func NotebookManage(ctx *context.Context) { | |||||
| func NotebookDel(ctx *context.Context) { | func NotebookDel(ctx *context.Context) { | ||||
| var jobID = ctx.Params(":jobid") | var jobID = ctx.Params(":jobid") | ||||
| task, err := models.GetCloudbrainByJobID(jobID) | |||||
| if err != nil { | |||||
| ctx.ServerError("GetCloudbrainByJobID failed", err) | |||||
| return | |||||
| } | |||||
| task := ctx.Cloudbrain | |||||
| if task.Status != string(models.ModelArtsCreateFailed) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsStopped) { | if task.Status != string(models.ModelArtsCreateFailed) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsStopped) { | ||||
| log.Error("the job(%s) has not been stopped", task.JobName) | log.Error("the job(%s) has not been stopped", task.JobName) | ||||
| @@ -337,7 +328,7 @@ func NotebookDel(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| _, err = modelarts.DelNotebook(jobID) | |||||
| _, err := modelarts.DelNotebook(jobID) | |||||
| if err != nil { | if err != nil { | ||||
| log.Error("DelJob(%s) failed:%v", task.JobName, err.Error()) | log.Error("DelJob(%s) failed:%v", task.JobName, err.Error()) | ||||
| ctx.ServerError("DelJob failed", err) | ctx.ServerError("DelJob failed", err) | ||||
| @@ -1421,14 +1412,9 @@ func TrainJobDel(ctx *context.Context) { | |||||
| func TrainJobStop(ctx *context.Context) { | func TrainJobStop(ctx *context.Context) { | ||||
| var jobID = ctx.Params(":jobid") | var jobID = ctx.Params(":jobid") | ||||
| task, err := models.GetCloudbrainByJobID(jobID) | |||||
| if err != nil { | |||||
| log.Error("GetCloudbrainByJobID(%s) failed:%v", task.JobName, err.Error()) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) | |||||
| return | |||||
| } | |||||
| task := ctx.Cloudbrain | |||||
| _, err = modelarts.StopTrainJob(jobID, strconv.FormatInt(task.VersionID, 10)) | |||||
| _, err := modelarts.StopTrainJob(jobID, strconv.FormatInt(task.VersionID, 10)) | |||||
| if err != nil { | if err != nil { | ||||
| log.Error("StopTrainJob(%s) failed:%v", task.JobName, err.Error()) | log.Error("StopTrainJob(%s) failed:%v", task.JobName, err.Error()) | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) | ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) | ||||