|
|
@@ -1288,15 +1288,17 @@ func TrainJobVersionShowModels(ctx *context.Context) { |
|
|
|
jobID := ctx.Params(":jobid") |
|
|
|
parentDir := ctx.Query("parentDir") |
|
|
|
versionName := ctx.Query("version_name") |
|
|
|
dirArray := strings.Split(parentDir, "/") |
|
|
|
// dirArray := strings.Split(parentDir, "/") |
|
|
|
task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) |
|
|
|
if err != nil { |
|
|
|
log.Error("no such job!", ctx.Data["msgID"]) |
|
|
|
ctx.ServerError("no such job:", err) |
|
|
|
return |
|
|
|
} |
|
|
|
parentDir = versionName |
|
|
|
models, err := storage.GetVersionObsListObject(task.JobName, parentDir) |
|
|
|
// parentDir = versionName |
|
|
|
VersionOutputPath := "V" + strconv.Itoa(task.TotalVersionCount) |
|
|
|
dirArray := strings.Split(VersionOutputPath, "/") |
|
|
|
models, err := storage.GetObsListObjectVersion(task.JobName, parentDir, VersionOutputPath) |
|
|
|
if err != nil { |
|
|
|
log.Info("get TrainJobListModel failed:", err) |
|
|
|
ctx.ServerError("GetVersionObsListObject:", err) |
|
|
@@ -1304,6 +1306,7 @@ func TrainJobVersionShowModels(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
ctx.Data["Path"] = dirArray |
|
|
|
// ctx.Data["Path"] = VersionOutputPath |
|
|
|
ctx.Data["Dirs"] = models |
|
|
|
ctx.Data["task"] = task |
|
|
|
ctx.Data["JobID"] = jobID |
|
|
@@ -1322,3 +1325,26 @@ func TrainJobDownloadModel(ctx *context.Context) { |
|
|
|
} |
|
|
|
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) |
|
|
|
} |
|
|
|
|
|
|
|
func TrainJobVersionDownloadModel(ctx *context.Context) { |
|
|
|
var jobID = ctx.Params(":jobid") |
|
|
|
|
|
|
|
parentDir := ctx.Query("parentDir") |
|
|
|
fileName := ctx.Query("fileName") |
|
|
|
versionName := ctx.Query("version_name") |
|
|
|
|
|
|
|
task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetCloudbrainByJobID(%s) failed:%v", task.JobName, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
VersionOutputPath := "V" + strconv.Itoa(task.TotalVersionCount) |
|
|
|
|
|
|
|
url, err := storage.GetObsCreateVersionSignedUrl(task.JobName, parentDir, fileName, VersionOutputPath) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetObsCreateSignedUrl failed: %v", err.Error(), ctx.Data["msgID"]) |
|
|
|
ctx.ServerError("GetObsCreateSignedUrl", err) |
|
|
|
return |
|
|
|
} |
|
|
|
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) |
|
|
|
} |