| @@ -367,51 +367,58 @@ func GetOneLevelAllObjectUnderDir(bucket string, prefixRootPath string, relative | |||
| if !strings.HasSuffix(input.Prefix, "/") { | |||
| input.Prefix += "/" | |||
| } | |||
| output, err := ObsCli.ListObjects(input) | |||
| fileInfos := make([]FileInfo, 0) | |||
| prefixLen := len(input.Prefix) | |||
| fileMap := make(map[string]bool, 0) | |||
| if err == nil { | |||
| for _, val := range output.Contents { | |||
| log.Info("val key=" + val.Key) | |||
| var isDir bool | |||
| var fileName string | |||
| if val.Key == input.Prefix { | |||
| continue | |||
| } | |||
| fileName = val.Key[prefixLen:] | |||
| log.Info("fileName =" + fileName) | |||
| files := strings.Split(fileName, "/") | |||
| if fileMap[files[0]] { | |||
| continue | |||
| } else { | |||
| fileMap[files[0]] = true | |||
| index := 1 | |||
| for { | |||
| output, err := ObsCli.ListObjects(input) | |||
| if err == nil { | |||
| log.Info("Page:%d\n", index) | |||
| index++ | |||
| for _, val := range output.Contents { | |||
| var isDir bool | |||
| var fileName string | |||
| if val.Key == input.Prefix { | |||
| continue | |||
| } | |||
| fileName = val.Key[prefixLen:] | |||
| files := strings.Split(fileName, "/") | |||
| if fileMap[files[0]] { | |||
| continue | |||
| } else { | |||
| fileMap[files[0]] = true | |||
| } | |||
| ParenDir := relativePath | |||
| fileName = files[0] | |||
| if len(files) > 1 { | |||
| isDir = true | |||
| ParenDir += fileName + "/" | |||
| } else { | |||
| isDir = false | |||
| } | |||
| fileInfo := FileInfo{ | |||
| ModTime: val.LastModified.Local().Format("2006-01-02 15:04:05"), | |||
| FileName: fileName, | |||
| Size: val.Size, | |||
| IsDir: isDir, | |||
| ParenDir: ParenDir, | |||
| } | |||
| fileInfos = append(fileInfos, fileInfo) | |||
| } | |||
| ParenDir := relativePath | |||
| fileName = files[0] | |||
| if len(files) > 1 { | |||
| isDir = true | |||
| ParenDir += fileName + "/" | |||
| if output.IsTruncated { | |||
| input.Marker = output.NextMarker | |||
| } else { | |||
| isDir = false | |||
| break | |||
| } | |||
| fileInfo := FileInfo{ | |||
| ModTime: val.LastModified.Local().Format("2006-01-02 15:04:05"), | |||
| FileName: fileName, | |||
| Size: val.Size, | |||
| IsDir: isDir, | |||
| ParenDir: ParenDir, | |||
| } else { | |||
| if obsError, ok := err.(obs.ObsError); ok { | |||
| log.Error("Code:%s, Message:%s", obsError.Code, obsError.Message) | |||
| } | |||
| 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 | |||
| } | |||
| return nil, err | |||
| } | |||
| return fileInfos, nil | |||
| } | |||
| func GetAllObjectByBucketAndPrefix(bucket string, prefix string) ([]FileInfo, error) { | |||
| @@ -268,7 +268,7 @@ page_dev_yunlao_desc4=开发者可以根据使用需求,自由选择相应计 | |||
| page_dev_yunlao_desc5=如果您的模型需要更多的计算资源,也可以单独申请。 | |||
| page_dev_yunlao_apply=单独申请 | |||
| c2net_title=中国算力网(C²NET) | |||
| c2net_desc=广泛接入全国各地智算中心、超算中心与大数据中心等,为用户提供免费算力资源 | |||
| c2net_desc=广泛接入全国各地智算中心、超算中心与大数据中心等,为用户提供普惠算力资源 | |||
| c2net_center=中心 | |||
| search=搜索 | |||
| search_repo=项目 | |||
| @@ -287,7 +287,7 @@ explore_AI = 探索更好的AI,来这里发现更有意思的 | |||
| datasets = 数据集 | |||
| repositories = 项目 | |||
| use_plt__fuction = 使用本平台提供的AI协作功能,如:托管代码、共享数据、调试算法或训练模型,请先 | |||
| provide_resoure = 平台目前免费提供CPU、GPU、NPU的算力资源,可进行多种类型的AI任务。 | |||
| provide_resoure = 平台目前提供CPU、GPU、NPU的普惠算力资源,可进行多种类型的AI任务。 | |||
| create_pro = 创建项目 | |||
| activity = 活动 | |||
| no_events = 还没有与您相关的活动 | |||
| @@ -98,11 +98,12 @@ func CloudBrains(ctx *context.Context) { | |||
| ciTasks[i].CanDebug = true | |||
| ciTasks[i].CanDel = true | |||
| ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | |||
| if ciTasks[i].Cloudbrain.Type == models.TypeC2Net { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.C2NetCluster | |||
| } else { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.OpenICluster | |||
| if ciTasks[i].Cloudbrain.Spec != nil { | |||
| if ciTasks[i].Cloudbrain.Type == models.TypeC2Net { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.C2NetCluster | |||
| } else { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.OpenICluster | |||
| } | |||
| } | |||
| } | |||
| @@ -470,7 +470,11 @@ func ModelList(ctx *context.APIContext) { | |||
| status := models.StorageScheduleSucceed | |||
| var fileInfos []storage.FileInfo | |||
| if task.ComputeResource == models.NPUResource { | |||
| fileInfos, err = storage.GetObsListObject(task.JobName, "output/", parentDir, versionName) | |||
| prefix := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, setting.OutPutPath, versionName), "/") | |||
| if !strings.HasSuffix(prefix, "/") { | |||
| prefix += "/" | |||
| } | |||
| fileInfos, err = storage.GetOneLevelAllObjectUnderDir(setting.Bucket, prefix, parentDir) | |||
| if err != nil { | |||
| log.Info("get TrainJobListModel failed:", err) | |||
| ctx.ServerError("GetObsListObject:", err) | |||
| @@ -484,6 +488,10 @@ func ModelList(ctx *context.APIContext) { | |||
| if models.IsTrainJobTerminal(task.Status) { | |||
| if task.Status == models.GrampusStatusStopped { | |||
| status = models.StorageNoFile | |||
| } else if task.Status == models.GrampusStatusFailed { | |||
| if task.AiCenter == "" { | |||
| status = models.StorageNoFile | |||
| } | |||
| } else { | |||
| record, _ := models.GetScheduleRecordByCloudbrainID(task.ID) | |||
| if record != nil { | |||
| @@ -840,11 +840,12 @@ func Cloudbrains(ctx *context.Context) { | |||
| ciTasks[i].CanDebug = true | |||
| ciTasks[i].CanDel = true | |||
| ciTasks[i].Cloudbrain.ComputeResource = ciTasks[i].ComputeResource | |||
| if ciTasks[i].Cloudbrain.Type == models.TypeC2Net { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.C2NetCluster | |||
| } else { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.OpenICluster | |||
| if ciTasks[i].Cloudbrain.Spec != nil { | |||
| if ciTasks[i].Cloudbrain.Type == models.TypeC2Net { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.C2NetCluster | |||
| } else { | |||
| ciTasks[i].Cloudbrain.Spec.Cluster = models.OpenICluster | |||
| } | |||
| } | |||
| } | |||
| pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | |||