| @@ -83,6 +83,40 @@ func GetAiSafetyTask(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| syncAiSafetyTaskStatus(job) | syncAiSafetyTaskStatus(job) | ||||
| job, err = models.GetCloudbrainByJobIDWithDeleted(ID) | |||||
| ctx.JSON(200, job) | |||||
| } | |||||
| func StopAiSafetyTask(ctx *context.Context) { | |||||
| } | |||||
| func DelAiSafetyTask(ctx *context.Context) { | |||||
| var ID = ctx.Params(":jobid") | |||||
| task, err := models.GetCloudbrainByJobIDWithDeleted(ID) | |||||
| result := make(map[string]interface{}) | |||||
| result["code"] = 1 | |||||
| if err != nil { | |||||
| log.Error("GetCloudbrainByJobID failed:" + err.Error()) | |||||
| result["msg"] = "No such task." | |||||
| ctx.JSON(200, result) | |||||
| 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.JSON(200, result) | |||||
| return | |||||
| } | |||||
| err = models.DeleteJob(task) | |||||
| if err != nil { | |||||
| result["msg"] = err.Error() | |||||
| ctx.JSON(200, result) | |||||
| return | |||||
| } | |||||
| result["code"] = 0 | |||||
| result["msg"] = "Succeed" | |||||
| ctx.JSON(200, result) | |||||
| } | } | ||||
| func syncAiSafetyTaskStatus(job *models.Cloudbrain) { | func syncAiSafetyTaskStatus(job *models.Cloudbrain) { | ||||
| @@ -350,14 +384,6 @@ func isTaskNotFinished(status string) bool { | |||||
| return false | return false | ||||
| } | } | ||||
| func StopAiSafetyTask(ctx *context.Context) { | |||||
| } | |||||
| func DelAiSafetyTask(ctx *context.Context) { | |||||
| } | |||||
| func AiSafetyCreateForGetGPU(ctx *context.Context) { | func AiSafetyCreateForGetGPU(ctx *context.Context) { | ||||
| t := time.Now() | t := time.Now() | ||||
| ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
| @@ -767,7 +793,7 @@ func createForGPU(ctx *context.Context, jobName string) { | |||||
| ctx.RenderWithErr(err.Error(), tplCloudBrainBenchmarkNew, nil) | ctx.RenderWithErr(err.Error(), tplCloudBrainBenchmarkNew, nil) | ||||
| return | return | ||||
| } | } | ||||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/modelsafety_test") | |||||
| //ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/modelsafety_test") | |||||
| } | } | ||||
| func getGpuModelSafetyCommand(BootFile string, params string, CkptName string, DisplayJobName string) (string, error) { | func getGpuModelSafetyCommand(BootFile string, params string, CkptName string, DisplayJobName string) (string, error) { | ||||