Browse Source

fix bug

tags/v1.21.12.1
liuzx 4 years ago
parent
commit
04c3ea18c2
4 changed files with 14 additions and 6 deletions
  1. +2
    -2
      modules/storage/obs.go
  2. +2
    -1
      routers/api/v1/repo/modelarts.go
  3. +8
    -1
      routers/repo/modelarts.go
  4. +2
    -2
      templates/repo/modelarts/trainjob/new.tmpl

+ 2
- 2
modules/storage/obs.go View File

@@ -176,10 +176,10 @@ func ObsModelDownload(JobName string, fileName string) (io.ReadCloser, error) {
}
}

func GetObsListObject(jobName, parentDir string, versionOutputPath string) ([]FileInfo, error) {
func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) {
input := &obs.ListObjectsInput{}
input.Bucket = setting.Bucket
input.Prefix = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, versionOutputPath, parentDir), "/")
input.Prefix = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, parentDir), "/")
strPrefix := strings.Split(input.Prefix, "/")
output, err := ObsCli.ListObjects(input)
fileInfos := make([]FileInfo, 0)


+ 2
- 1
routers/api/v1/repo/modelarts.go View File

@@ -303,7 +303,8 @@ func ModelList(ctx *context.APIContext) {
return
}
VersionOutputPath := modelarts.GetVersionOutputPathByTotalVersionCount(task.TotalVersionCount)
models, err := storage.GetObsListObject(task.JobName, parentDir, VersionOutputPath)
parentDir = VersionOutputPath + "/" + parentDir
models, err := storage.GetObsListObject(task.JobName, parentDir)
if err != nil {
log.Info("get TrainJobListModel failed:", err)
ctx.ServerError("GetObsListObject:", err)


+ 8
- 1
routers/repo/modelarts.go View File

@@ -369,6 +369,7 @@ func trainJobNewDataPrepare(ctx *context.Context) error {
}
ctx.Data["Branches"] = Branches
ctx.Data["BranchesCount"] = len(Branches)
ctx.Data["params"] = ""

configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom)
if err != nil {
@@ -450,16 +451,22 @@ func ErrorNewDataPrepare(ctx *context.Context, form auth.CreateModelArtsTrainJob
ctx.ServerError("getConfigList failed:", err)
return err
}
var Parameters modelarts.Parameters
if err = json.Unmarshal([]byte(form.Params), &Parameters); err != nil {
ctx.ServerError("json.Unmarshal failed:", err)
return err
}
ctx.Data["params"] = Parameters.Parameter
ctx.Data["config_list"] = configList.ParaConfigs
ctx.Data["bootFile"] = form.BootFile
ctx.Data["uuid"] = form.Attachment
ctx.Data["params"] = form.Params
ctx.Data["branch_name"] = form.BranchName

return nil
}

func TrainJobNewVersion(ctx *context.Context) {

err := trainJobNewVersionDataPrepare(ctx)
if err != nil {
ctx.ServerError("get new train-job info failed", err)


+ 2
- 2
templates/repo/modelarts/trainjob/new.tmpl View File

@@ -236,7 +236,7 @@
<span id="add_run_para" style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span>
<input id="store_run_para" type="hidden" name="run_para_list">
<div class="dynamic field" style="margin-top: 1rem;">
<!-- {{if ne 0 (len .params)}}
{{if ne 0 (len .params)}}
{{range $k ,$v := .params}}
<div class="two fields width85" id="para{{$k}}">
<div class="field">
@@ -251,7 +251,7 @@

</div>
{{end}}
{{end}} -->
{{end}}
</div>
</div>



Loading…
Cancel
Save