|
|
@@ -178,6 +178,7 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { |
|
|
input := &obs.ListObjectsInput{} |
|
|
input := &obs.ListObjectsInput{} |
|
|
input.Bucket = setting.Bucket |
|
|
input.Bucket = setting.Bucket |
|
|
input.Prefix = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, parentDir), "/") |
|
|
input.Prefix = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, parentDir), "/") |
|
|
|
|
|
strPrefix := strings.Split(input.Prefix, "/") |
|
|
output, err := ObsCli.ListObjects(input) |
|
|
output, err := ObsCli.ListObjects(input) |
|
|
fileInfos := make([]FileInfo, 0) |
|
|
fileInfos := make([]FileInfo, 0) |
|
|
if err == nil { |
|
|
if err == nil { |
|
|
@@ -186,15 +187,29 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { |
|
|
var isDir bool |
|
|
var isDir bool |
|
|
var fileName,nextParentDir string |
|
|
var fileName,nextParentDir string |
|
|
if strings.HasSuffix(val.Key, "/") { |
|
|
if strings.HasSuffix(val.Key, "/") { |
|
|
|
|
|
//dirs in next level dir |
|
|
|
|
|
if len(str1) - len(strPrefix) > 2 { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
fileName = str1[len(str1)-2] |
|
|
fileName = str1[len(str1)-2] |
|
|
isDir = true |
|
|
isDir = true |
|
|
nextParentDir = fileName |
|
|
|
|
|
if fileName == parentDir || (fileName + "/") == setting.OutPutPath { |
|
|
|
|
|
|
|
|
if parentDir == "" { |
|
|
|
|
|
nextParentDir = fileName |
|
|
|
|
|
} else { |
|
|
|
|
|
nextParentDir = parentDir + "/" + fileName |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if fileName == strPrefix[len(strPrefix)-1] || (fileName + "/") == setting.OutPutPath { |
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
//files in next level dir |
|
|
|
|
|
if len(str1) - len(strPrefix) > 1 { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
fileName = str1[len(str1)-1] |
|
|
fileName = str1[len(str1)-1] |
|
|
isDir = false |
|
|
isDir = false |
|
|
|
|
|
nextParentDir = parentDir |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fileInfo := FileInfo{ |
|
|
fileInfo := FileInfo{ |
|
|
|