| @@ -294,62 +294,6 @@ func GetObsListObjectVersion(jobName, parentDir string, VersionOutputPath string | |||
| } | |||
| } | |||
| func GetVersionObsListObject(jobName, parentDir string) ([]FileInfo, error) { | |||
| input := &obs.ListObjectsInput{} | |||
| input.Bucket = setting.Bucket | |||
| 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) | |||
| if err == nil { | |||
| for _, val := range output.Contents { | |||
| str1 := strings.Split(val.Key, "/") | |||
| var isDir bool | |||
| var fileName, nextParentDir string | |||
| if strings.HasSuffix(val.Key, "/") { | |||
| //dirs in next level dir | |||
| if len(str1)-len(strPrefix) > 2 { | |||
| continue | |||
| } | |||
| fileName = str1[len(str1)-2] | |||
| isDir = true | |||
| if parentDir == "" { | |||
| nextParentDir = fileName | |||
| } else { | |||
| nextParentDir = parentDir + "/" + fileName | |||
| } | |||
| if fileName == strPrefix[len(strPrefix)-1] || (fileName+"/") == setting.OutPutPath { | |||
| continue | |||
| } | |||
| } else { | |||
| //files in next level dir | |||
| if len(str1)-len(strPrefix) > 1 { | |||
| continue | |||
| } | |||
| fileName = str1[len(str1)-1] | |||
| isDir = false | |||
| nextParentDir = parentDir | |||
| } | |||
| fileInfo := FileInfo{ | |||
| ModTime: val.LastModified.Local().Format("2006-01-02 15:04:05"), | |||
| FileName: fileName, | |||
| Size: val.Size, | |||
| IsDir: isDir, | |||
| ParenDir: nextParentDir, | |||
| } | |||
| fileInfos = append(fileInfos, fileInfo) | |||
| } | |||
| return fileInfos, err | |||
| } else { | |||
| if obsError, ok := err.(obs.ObsError); ok { | |||
| log.Error("Code:%s, Message:%s", obsError.Code, obsError.Message) | |||
| } | |||
| return nil, err | |||
| } | |||
| } | |||
| func ObsGenMultiPartSignedUrl(uuid string, uploadId string, partNumber int, fileName string) (string, error) { | |||
| input := &obs.CreateSignedUrlInput{} | |||
| @@ -874,17 +874,12 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
| }) | |||
| m.Group("/train-job", func() { | |||
| m.Group("/:jobid", func() { | |||
| // m.Get("", repo.GetModelArtsTrainJob) | |||
| m.Get("", repo.GetModelArtsTrainJobVersion) | |||
| // m.Get("/log", repo.TrainJobGetLog) | |||
| m.Get("/log", repo.TrainJobGetLog) | |||
| m.Post("/del_version", repo.DelTrainJobVersion) | |||
| m.Post("/stop_version", repo.StopTrainJobVersion) | |||
| m.Get("/model_list", repo.ModelList) | |||
| m.Get("/model_download", repo.ModelDownload) | |||
| // m.Group("/:version-name", func() { | |||
| // m.Get("", repo.GetModelArtsTrainJobVersion) | |||
| // }) | |||
| }) | |||
| }) | |||
| }, reqRepoReader(models.UnitTypeCloudBrain)) | |||
| @@ -989,21 +989,14 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
| m.Get("", reqRepoCloudBrainReader, repo.TrainJobShow) | |||
| m.Post("/stop", reqRepoCloudBrainWriter, repo.TrainJobStop) | |||
| m.Post("/del", reqRepoCloudBrainWriter, repo.TrainJobDel) | |||
| // m.Get("/log", reqRepoCloudBrainReader, repo.TrainJobGetLog) | |||
| // m.Get("/models", reqRepoCloudBrainReader, repo.TrainJobShowModels) | |||
| m.Get("/models", reqRepoCloudBrainReader, repo.TrainJobVersionShowModels) | |||
| // m.Get("/download_model", reqRepoCloudBrainReader, repo.TrainJobDownloadModel) | |||
| m.Get("/download_model", reqRepoCloudBrainReader, repo.TrainJobVersionDownloadModel) | |||
| m.Get("/create_version", reqRepoCloudBrainReader, repo.TrainJobNewVersion) | |||
| m.Post("/create_version", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) | |||
| // }) | |||
| }) | |||
| m.Get("/create", reqRepoCloudBrainReader, repo.TrainJobNew) | |||
| m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreate) | |||
| // m.Get("/create", reqRepoCloudBrainReader, repo.TrainJobNewVersion) | |||
| // m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) | |||
| m.Get("/para-config-list", reqRepoCloudBrainReader, repo.TrainJobGetConfigList) | |||
| }) | |||
| }, context.RepoRef()) | |||