Browse Source

opt

tags/v1.22.6.2
lewis 3 years ago
parent
commit
6f642da6c3
2 changed files with 30 additions and 15 deletions
  1. +4
    -3
      modules/grampus/grampus.go
  2. +26
    -12
      routers/repo/grampus.go

+ 4
- 3
modules/grampus/grampus.go View File

@@ -78,6 +78,7 @@ type GenerateTrainJobReq struct {
TotalVersionCount int
ComputeResource string
DatasetName string
Params string
}

func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error) {
@@ -119,9 +120,9 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error
//EngineID: req.EngineID,
TrainUrl: req.TrainUrl,
BranchName: req.BranchName,
//Parameters: req.Params,
BootFile: req.BootFile,
DataUrl: req.DataUrl,
Parameters: req.Params,
BootFile: req.BootFile,
DataUrl: req.DataUrl,
//LogUrl: req.LogUrl,
//FlavorCode: req.FlavorCode,
Description: req.Description,


+ 26
- 12
routers/repo/grampus.go View File

@@ -236,8 +236,6 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain
VersionOutputPath := modelarts.GetOutputPathByCount(modelarts.TotalVersionCount)
displayJobName := form.DisplayJobName
jobName := util.ConvertDisplayJobNameToJobName(displayJobName)
//todo:del
jobName = displayJobName
uuid := form.Attachment
description := form.Description
bootFile := form.BootFile
@@ -252,8 +250,6 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain
VersionCount := modelarts.VersionCount
EngineName := form.EngineName

log.Info(jobName)

count, err := models.GetGrampusCountByUserID(ctx.User.ID, string(models.JobTypeTrain), models.NPUResource)
if err != nil {
log.Error("GetGrampusCountByUserID failed:%v", err, ctx.Data["MsgID"])
@@ -387,10 +383,10 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain
//PoolID: poolID,
Uuid: uuid,
//Parameters: param,
CommitID: commitID,
IsLatestVersion: isLatestVersion,
BranchName: branchName,
//Params: form.Params,
CommitID: commitID,
IsLatestVersion: isLatestVersion,
BranchName: branchName,
Params: form.Params,
FlavorName: FlavorName,
EngineName: EngineName,
VersionCount: VersionCount,
@@ -507,7 +503,6 @@ func deleteGrampusJob(ctx *context.Context) error {

func GrampusTrainJobShow(ctx *context.Context) {
ctx.Data["PageIsCloudBrain"] = true
//debugListType := ctx.Query("debugListType")

var task *models.Cloudbrain
task, err := models.GetCloudbrainByJobIDWithDeleted(ctx.Params(":jobid"))
@@ -522,9 +517,24 @@ func GrampusTrainJobShow(ctx *context.Context) {
task.DatasetName = attachment.Name
}

taskList := make([]*models.Cloudbrain, 0)
taskList = append(taskList, task)
ctx.Data["version_list_task"] = taskList
if len(task.Parameters) > 0 {
var parameters models.Parameters
err := json.Unmarshal([]byte(task.Parameters), &parameters)
if err != nil {
log.Error("Failed to Unmarshal Parameters: %s (%v)", task.Parameters, err)
ctx.ServerError("system error", err)
return
}

if len(parameters.Parameter) > 0 {
paramTemp := ""
for _, Parameter := range parameters.Parameter {
param := Parameter.Label + " = " + Parameter.Value + "; "
paramTemp = paramTemp + param
}
task.Parameters = paramTemp[:len(paramTemp)-2]
}
}

if task.DeletedAt.IsZero() { //normal record
result, err := grampus.GetJob(task.JobID)
@@ -555,6 +565,10 @@ func GrampusTrainJobShow(ctx *context.Context) {
}
}

taskList := make([]*models.Cloudbrain, 0)
taskList = append(taskList, task)
ctx.Data["version_list_task"] = taskList

ctx.HTML(http.StatusOK, tplGrampusTrainJobShow)
}



Loading…
Cancel
Save