Browse Source

gpu multi dataset

tags/v1.22.6.2^2
lewis 4 years ago
parent
commit
311dbe0927
2 changed files with 65 additions and 52 deletions
  1. +58
    -45
      modules/cloudbrain/cloudbrain.go
  2. +7
    -7
      routers/repo/cloudbrain.go

+ 58
- 45
modules/cloudbrain/cloudbrain.go View File

@@ -249,7 +249,63 @@ func GenerateTask(req GenerateCloudBrainTaskReq) error {
return errors.New("no such resourceSpec")
}

log.Info(req.DatasetInfos[req.Uuids].DataLocalPath)
volumes := []models.Volume{
{
HostPath: models.StHostPath{
Path: req.CodePath,
MountPath: CodeMountPath,
ReadOnly: false,
},
},
{
HostPath: models.StHostPath{
Path: req.ModelPath,
MountPath: ModelMountPath,
ReadOnly: false,
},
},
{
HostPath: models.StHostPath{
Path: req.BenchmarkPath,
MountPath: BenchMarkMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.Snn4ImageNetPath,
MountPath: Snn4imagenetMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.BrainScorePath,
MountPath: BrainScoreMountPath,
ReadOnly: true,
},
},
}

if len(req.DatasetInfos) == 1 {
volumes = append(volumes, models.Volume{
HostPath: models.StHostPath{
Path: req.DatasetInfos[req.Uuids].DataLocalPath,
MountPath: DataSetMountPath,
ReadOnly: true,
},
})
} else {
for _, dataset := range req.DatasetInfos {
volumes = append(volumes, models.Volume{
HostPath: models.StHostPath{
Path: dataset.DataLocalPath,
MountPath: DataSetMountPath + "/" + dataset.Name,
ReadOnly: true,
},
})
}
}

createTime := timeutil.TimeStampNow()
jobResult, err := CreateJob(req.JobName, models.CreateJobParams{
@@ -273,50 +329,7 @@ func GenerateTask(req GenerateCloudBrainTaskReq) error {
UseNNI: false,
},
},
Volumes: []models.Volume{
{
HostPath: models.StHostPath{
Path: req.CodePath,
MountPath: CodeMountPath,
ReadOnly: false,
},
},
{
HostPath: models.StHostPath{
Path: req.DatasetInfos[req.Uuids].DataLocalPath,
MountPath: DataSetMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.ModelPath,
MountPath: ModelMountPath,
ReadOnly: false,
},
},
{
HostPath: models.StHostPath{
Path: req.BenchmarkPath,
MountPath: BenchMarkMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.Snn4ImageNetPath,
MountPath: Snn4imagenetMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.BrainScorePath,
MountPath: BrainScoreMountPath,
ReadOnly: true,
},
},
},
Volumes: volumes,
})
if err != nil {
log.Error("CreateJob failed:", err.Error(), req.Ctx.Data["MsgID"])


+ 7
- 7
routers/repo/cloudbrain.go View File

@@ -2290,7 +2290,7 @@ func GetBenchmarkTypes(ctx *context.Context) *models.BenchmarkTypes {
func getDatasetInfo(uuidStr string) (map[string]cloudbrain.DatasetInfo, string, error) {
var datasetNames string
uuids := strings.Split(uuidStr, ";")
if len(uuids) > 5 {
if len(uuids) > setting.MaxDatasetNum {
log.Error("the dataset count(%d) exceed the limit", len(uuids))
return nil, datasetNames, errors.New("the dataset count exceed the limit")
}
@@ -2303,9 +2303,11 @@ func getDatasetInfo(uuidStr string) (map[string]cloudbrain.DatasetInfo, string,
return nil, datasetNames, err
}

if _, ok := datasetInfos[uuid]; ok {
log.Error("the dataset name is same: %v", attach.Name)
return nil, datasetNames, errors.New("the dataset name is same")
for _, datasetInfo := range datasetInfos {
if attach.Name == datasetInfo.Name {
log.Error("the dataset name is same: %v", attach.Name)
return nil, datasetNames, errors.New("the dataset name is same")
}
}

dataLocalPath := setting.Attachment.Minio.RealPath +
@@ -2316,7 +2318,7 @@ func getDatasetInfo(uuidStr string) (map[string]cloudbrain.DatasetInfo, string,

datasetInfos[uuid] = cloudbrain.DatasetInfo{
DataLocalPath: dataLocalPath,
Name: attach.Name,
Name: strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(attach.Name, ".zip"), ".tar.gz"), ".tgz"),
}
if i == 0 {
datasetNames = attach.Name
@@ -2325,7 +2327,5 @@ func getDatasetInfo(uuidStr string) (map[string]cloudbrain.DatasetInfo, string,
}
}

log.Info(datasetNames)

return datasetInfos, datasetNames, nil
}

Loading…
Cancel
Save