Browse Source

整理代码

tags/v1.22.1.2
liuzx 3 years ago
parent
commit
d183804b13
2 changed files with 3 additions and 11 deletions
  1. +2
    -2
      routers/repo/modelarts.go
  2. +1
    -9
      routers/routes/routes.go

+ 2
- 2
routers/repo/modelarts.go View File

@@ -1852,7 +1852,7 @@ func inferenceJobErrorNewDataPrepare(ctx *context.Context, form auth.CreateModel
var jobName = "inference" + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:]
ctx.Data["job_name"] = jobName

attachs, err := models.GetModelArtsUserAttachments(ctx.User.ID)
attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID)
if err != nil {
ctx.ServerError("GetAllUserAttachments failed:", err)
return err
@@ -2002,7 +2002,7 @@ func ResultDownload(ctx *context.Context) {
if err != nil {
ctx.Data["error"] = err.Error()
}
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, modelarts.ResultPath, versionName, parentDir, fileName), "/")
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, "result/", versionName, parentDir, fileName), "/")
log.Info("Download path is:%s", path)

url, err := storage.GetObsCreateSignedUrlByBucketAndKey(setting.Bucket, path)


+ 1
- 9
routers/routes/routes.go View File

@@ -34,7 +34,6 @@ import (
"code.gitea.io/gitea/routers"
"code.gitea.io/gitea/routers/admin"
apiv1 "code.gitea.io/gitea/routers/api/v1"
apiv1repo "code.gitea.io/gitea/routers/api/v1/repo"
"code.gitea.io/gitea/routers/dev"
"code.gitea.io/gitea/routers/events"
"code.gitea.io/gitea/routers/org"
@@ -1027,10 +1026,6 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/model_download", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.ModelDownload)
m.Get("/create_version", cloudbrain.AdminOrJobCreaterRight, repo.TrainJobNewVersion)
m.Post("/create_version", cloudbrain.AdminOrJobCreaterRight, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion)
m.Get("/log", apiv1repo.TrainJobGetLog)
m.Post("/del_version", apiv1repo.DelTrainJobVersion)
m.Post("/stop_version", apiv1repo.StopTrainJobVersion)
m.Get("/model_list", apiv1repo.ModelList)
})
m.Get("/create", reqRepoCloudBrainWriter, repo.TrainJobNew)
m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreate)
@@ -1042,10 +1037,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("", reqRepoCloudBrainReader, repo.InferenceJobIndex)
m.Group("/:jobid", func() {
m.Get("", reqRepoCloudBrainReader, repo.InferenceJobShow)
m.Get("/log", apiv1repo.TrainJobGetLog)
m.Post("/del_version", apiv1repo.DelTrainJobVersion)
m.Post("/stop_version", apiv1repo.StopTrainJobVersion)
m.Get("/result_list", apiv1repo.ResultList)
m.Get("/result_download", reqRepoCloudBrainReader, repo.ResultDownload)
m.Get("/downloadall", repo.DownloadMultiResultFile)
})
m.Get("/create", reqRepoCloudBrainWriter, repo.InferenceJobNew)


Loading…
Cancel
Save