Browse Source

figbug-1022

tags/v1.21.12.1^2
liuzx 4 years ago
parent
commit
eb1b01a75d
3 changed files with 29 additions and 7 deletions
  1. +1
    -0
      modules/modelarts/modelarts.go
  2. +15
    -5
      routers/repo/cloudbrain.go
  3. +13
    -2
      routers/repo/modelarts.go

+ 1
- 0
modules/modelarts/modelarts.go View File

@@ -51,6 +51,7 @@ const (
ComputeResource = "NPU"
NPUResource = "NPU"
GPUResource = "CPU/GPU"
AllResource = "all"
DebugType = -1
VersionCount = 1



+ 15
- 5
routers/repo/cloudbrain.go View File

@@ -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) {


+ 13
- 2
routers/repo/modelarts.go View File

@@ -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) {


Loading…
Cancel
Save