| @@ -392,14 +392,14 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| engineName := form.EngineName | engineName := form.EngineName | ||||
| if !jobNamePattern.MatchString(displayJobName) { | if !jobNamePattern.MatchString(displayJobName) { | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| errStr := checkSpecialPool(ctx, "NPU") | errStr := checkSpecialPool(ctx, "NPU") | ||||
| if errStr != "" { | if errStr != "" { | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr(errStr, tplGrampusTrainJobGPUNew, &form) | ctx.RenderWithErr(errStr, tplGrampusTrainJobGPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -408,13 +408,13 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| count, err := models.GetGrampusCountByUserID(ctx.User.ID, string(models.JobTypeTrain), models.NPUResource) | count, err := models.GetGrampusCountByUserID(ctx.User.ID, string(models.JobTypeTrain), models.NPUResource) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("GetGrampusCountByUserID failed:%v", err, ctx.Data["MsgID"]) | log.Error("GetGrampusCountByUserID failed:%v", err, ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("system error", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("system error", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } else { | } else { | ||||
| if count >= 1 { | if count >= 1 { | ||||
| log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) | log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -423,7 +423,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| //check param | //check param | ||||
| if err := grampusParamCheckCreateTrainJob(form); err != nil { | if err := grampusParamCheckCreateTrainJob(form); err != nil { | ||||
| log.Error("paramCheckCreateTrainJob failed:(%v)", err) | log.Error("paramCheckCreateTrainJob failed:(%v)", err) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr(err.Error(), tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr(err.Error(), tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -433,14 +433,14 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| if err == nil { | if err == nil { | ||||
| if len(tasks) != 0 { | if len(tasks) != 0 { | ||||
| log.Error("the job name did already exist", ctx.Data["MsgID"]) | log.Error("the job name did already exist", ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("the job name did already exist", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("the job name did already exist", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| } else { | } else { | ||||
| if !models.IsErrJobNotExist(err) { | if !models.IsErrJobNotExist(err) { | ||||
| log.Error("system error, %v", err, ctx.Data["MsgID"]) | log.Error("system error, %v", err, ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("system error", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("system error", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -450,7 +450,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| attachment, err := models.GetAttachmentByUUID(uuid) | attachment, err := models.GetAttachmentByUUID(uuid) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("GetAttachmentByUUID failed:", err.Error(), ctx.Data["MsgID"]) | log.Error("GetAttachmentByUUID failed:", err.Error(), ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("dataset is not exist", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("dataset is not exist", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -463,7 +463,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| if err := downloadZipCode(ctx, codeLocalPath, branchName); err != nil { | if err := downloadZipCode(ctx, codeLocalPath, branchName); err != nil { | ||||
| log.Error("downloadZipCode failed, server timed out: %s (%v)", repo.FullName(), err) | log.Error("downloadZipCode failed, server timed out: %s (%v)", repo.FullName(), err) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("Create task failed, server timed out", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("Create task failed, server timed out", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -478,7 +478,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | ||||
| log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("Failed to uploadCodeToObs", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("Failed to uploadCodeToObs", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -487,7 +487,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| command, err := generateCommand(repo.Name, grampus.ProcessorTypeNPU, codeObsPath+cloudbrain.DefaultBranchName+".zip", dataObsPath+"'"+attachment.Name+"'", bootFile, params, setting.CodePathPrefix+jobName+modelarts.OutputPath, attachment.Name) | command, err := generateCommand(repo.Name, grampus.ProcessorTypeNPU, codeObsPath+cloudbrain.DefaultBranchName+".zip", dataObsPath+"'"+attachment.Name+"'", bootFile, params, setting.CodePathPrefix+jobName+modelarts.OutputPath, attachment.Name) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("Failed to generateCommand: %s (%v)", displayJobName, err, ctx.Data["MsgID"]) | log.Error("Failed to generateCommand: %s (%v)", displayJobName, err, ctx.Data["MsgID"]) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr("Create task failed, internal error", tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr("Create task failed, internal error", tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -523,7 +523,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||||
| err = grampus.GenerateTrainJob(ctx, req) | err = grampus.GenerateTrainJob(ctx, req) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("GenerateTrainJob failed:%v", err.Error()) | log.Error("GenerateTrainJob failed:%v", err.Error()) | ||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||||
| ctx.RenderWithErr(err.Error(), tplGrampusTrainJobNPUNew, &form) | ctx.RenderWithErr(err.Error(), tplGrampusTrainJobNPUNew, &form) | ||||
| return | return | ||||
| } | } | ||||