Browse Source

opt

tags/v1.21.12.2^2
lewis 4 years ago
parent
commit
e49d824fa4
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      routers/repo/cloudbrain.go

+ 7
- 6
routers/repo/cloudbrain.go View File

@@ -249,12 +249,6 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
}

func CloudBrainRestart(ctx *context.Context) {
/*
todo: 是否启用事务?
启用:处理时间可能比较长,容易出现大事务
不启用:容易出现脏数据
*/

var jobID = ctx.Params(":jobid")
var resultCode = "0"
var errorMsg = ""
@@ -276,6 +270,13 @@ func CloudBrainRestart(ctx *context.Context) {
break
}

if task.Image == "" || task.GpuQueue == "" || task.Type != models.TypeCloudBrainOne {
log.Error("the job(%s) version is too old", task.JobName, ctx.Data["MsgID"])
resultCode = "-1"
errorMsg = "the job's version is too old and can not be restarted"
break
}

count, err := models.GetCloudbrainCountByUserID(ctx.User.ID)
if err != nil {
log.Error("GetCloudbrainCountByUserID failed:%v", err, ctx.Data["MsgID"])


Loading…
Cancel
Save