diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index cd81b32bc..f98642574 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -51,6 +51,7 @@ const ( ComputeResource = "NPU" NPUResource = "NPU" GPUResource = "CPU/GPU" + AllResource = "all" DebugType = -1 VersionCount = 1 diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index b2ded0752..324aa89c2 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -80,6 +80,7 @@ func CloudBrainIndex(ctx *context.Context) { } ciTasks[i].CanDel = cloudbrain.CanDeleteDebugJob(ctx, &task.Cloudbrain) + ciTasks[i].Cloudbrain.ComputeResource = modelarts.GPUResource } @@ -340,7 +341,7 @@ func CloudBrainDebug(ctx *context.Context) { var jobID = ctx.Params(":jobid") if !ctx.IsSigned { log.Error("the user has not signed in") - ctx.Error(http.StatusForbidden, "","the user has not signed in") + ctx.Error(http.StatusForbidden, "", "the user has not signed in") return } task, err := models.GetCloudbrainByJobID(jobID) @@ -357,7 +358,7 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain var jobID = ctx.Params(":jobid") if !ctx.IsSigned { log.Error("the user has not signed in") - ctx.Error(http.StatusForbidden, "","the user has not signed in") + ctx.Error(http.StatusForbidden, "", "the user has not signed in") return } task, err := models.GetCloudbrainByJobID(jobID) @@ -392,6 +393,7 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain func CloudBrainStop(ctx *context.Context) { var jobID = ctx.Params(":jobid") + debugListType := ctx.Query("debugListType") task, err := models.GetCloudbrainByJobID(jobID) if err != nil { ctx.ServerError("GetCloudbrainByJobID failed", err) @@ -417,8 +419,12 @@ func CloudBrainStop(ctx *context.Context) { ctx.ServerError("UpdateJob failed", err) return } + if debugListType == modelarts.AllResource { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") + } else { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain") + } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain") } func StopJobsByUserID(userID int64) { @@ -503,6 +509,7 @@ func logErrorAndUpdateJobStatus(err error, taskInfo *models.Cloudbrain) { func CloudBrainDel(ctx *context.Context) { var jobID = ctx.Params(":jobid") + debugListType := ctx.Query("debugListType") task, err := models.GetCloudbrainByJobID(jobID) if err != nil { ctx.ServerError("GetCloudbrainByJobID failed", err) @@ -520,8 +527,11 @@ func CloudBrainDel(ctx *context.Context) { ctx.ServerError("DeleteJob failed", err) return } - - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain") + if debugListType == modelarts.AllResource { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") + } else { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain") + } } func CloudBrainShowModels(ctx *context.Context) { diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index ca3d1cfac..8b09164d3 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -131,6 +131,7 @@ func NotebookIndex(ctx *context.Context) { ciTasks[i].CanDebug = false } ciTasks[i].CanDel = cloudbrain.CanDeleteDebugJob(ctx, &task.Cloudbrain) + ciTasks[i].Cloudbrain.ComputeResource = modelarts.NPUResource } pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5) @@ -274,6 +275,7 @@ func NotebookDebug(ctx *context.Context) { func NotebookStop(ctx *context.Context) { var jobID = ctx.Params(":jobid") + debugListType := ctx.Query("debugListType") log.Info(jobID) task, err := models.GetCloudbrainByJobID(jobID) if err != nil { @@ -304,11 +306,16 @@ func NotebookStop(ctx *context.Context) { return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") + if debugListType == modelarts.AllResource { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") + } else { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") + } } func NotebookDel(ctx *context.Context) { var jobID = ctx.Params(":jobid") + debugListType := ctx.Query("debugListType") task, err := models.GetCloudbrainByJobID(jobID) if err != nil { ctx.ServerError("GetCloudbrainByJobID failed", err) @@ -334,7 +341,11 @@ func NotebookDel(ctx *context.Context) { return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") + if debugListType == modelarts.AllResource { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob") + } else { + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/notebook") + } } func TrainJobIndex(ctx *context.Context) {