Browse Source

云脑二多数据选择

tags/v1.22.6.2^2
liuzx 3 years ago
parent
commit
b017248de6
1 changed files with 29 additions and 3 deletions
  1. +29
    -3
      routers/repo/modelarts.go

+ 29
- 3
routers/repo/modelarts.go View File

@@ -979,14 +979,19 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm)
codeObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.CodePath
outputObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.OutputPath + VersionOutputPath + "/"
logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath + VersionOutputPath + "/"
dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/"
// dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/"
branch_name := form.BranchName
isLatestVersion := modelarts.IsLatestVersion
FlavorName := form.FlavorName
VersionCount := modelarts.VersionCount
EngineName := form.EngineName
dataPath = "/test-opendata/attachment/1/2/12974bf4-3865-4995-a14f-e9e2af343f2f12974bf4-3865-4995-a14f-e9e2af343f2f/;s3://test-opendata/attachment/1/2/12974bf4-3865-4995-a14f-e9e2af343f2f12974bf4-3865-4995-a14f-e9e2af343f2f/"

dataPath, err := GetObsDataPath(uuid)
if err != nil {
log.Error("GetObsDataPath failed:%v", err, ctx.Data["MsgID"])
trainJobErrorNewDataPrepare(ctx, form)
ctx.RenderWithErr("GetObsDataPath error", tplModelArtsTrainJobNew, &form)
return
}
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID)
if err != nil {
log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"])
@@ -2421,3 +2426,24 @@ func TrainJobDownloadLogFile(ctx *context.Context) {
ctx.Resp.Header().Set("Cache-Control", "max-age=0")
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently)
}
func GetObsDataPath(uuid string) (string, error) {
var obsDataPath string
list := strings.Split(uuid, ";")
for k, uuidStr := range list {
_, err := models.GetAttachmentByUUID(uuidStr)
if err != nil {
log.Error("GetAttachmentByUUID failed:%v", err)
return "", err
} else {
if k <= 0 {
obsDataPath = "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/"
}
if k > 0 {
obsDataPathNext := ";" + "s3://" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + uuid + "/"
obsDataPath = obsDataPath + obsDataPathNext
}

}
}
return obsDataPath, nil
}

Loading…
Cancel
Save