Browse Source

#3277

gcu:fix bug of npu dataset error
tags/v1.22.12.2^2
chenyifan01 3 years ago
parent
commit
bd6daf4559
2 changed files with 36 additions and 1 deletions
  1. +2
    -0
      models/cloudbrain.go
  2. +34
    -1
      modules/grampus/grampus.go

+ 2
- 0
models/cloudbrain.go View File

@@ -2579,6 +2579,7 @@ type DatasetInfo struct {
DataLocalPath string
Name string
FullName string
Type int
}

func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetInfo, string, error) {
@@ -2640,6 +2641,7 @@ func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetIn
DataLocalPath: dataLocalPath,
Name: fileName,
FullName: attach.Name,
Type: attach.Type,
}
if i == 0 {
datasetNames = attach.Name


+ 34
- 1
modules/grampus/grampus.go View File

@@ -149,6 +149,35 @@ func getDatasetGPUGrampus(datasetInfos map[string]models.DatasetInfo) ([]models.
}
return datasetGrampus, command
}
func getDatasetGCUGrampus(datasetInfos map[string]models.DatasetInfo) ([]models.GrampusDataset, string) {
var datasetGrampus []models.GrampusDataset
var command = ""
epuEndPoint := getEndPoint()
for uuid, datasetInfo := range datasetInfos {
if datasetInfo.Type == models.TypeCloudBrainOne {
datasetGrampus = append(datasetGrampus, models.GrampusDataset{
Name: datasetInfo.FullName,
Bucket: setting.Attachment.Minio.Bucket,
EndPoint: setting.Attachment.Minio.Endpoint,
ObjectKey: datasetInfo.DataLocalPath,
ReadOnly: true,
ContainerPath: "/dataset1/" + datasetInfo.Name,
})

command += "cp /dataset1/'" + datasetInfo.Name + "'/" + uuid + " /dataset/'" + datasetInfo.FullName + "';"

} else {
datasetGrampus = append(datasetGrampus, models.GrampusDataset{
Name: datasetInfo.FullName,
Bucket: setting.Bucket,
EndPoint: epuEndPoint,
ObjectKey: datasetInfo.DataLocalPath + datasetInfo.FullName,
})
}

}
return datasetGrampus, command
}

func GenerateNotebookJob(ctx *context.Context, req *GenerateNotebookJobReq) (jobId string, err error) {
createTime := timeutil.TimeStampNow()
@@ -179,7 +208,11 @@ func GenerateNotebookJob(ctx *context.Context, req *GenerateNotebookJobReq) (job
imageUrl = ""
req.Command = ""
} else {
datasetGrampus, cpCommand = getDatasetGPUGrampus(req.DatasetInfos)
if ProcessorTypeGCU == req.ProcessType {
datasetGrampus, cpCommand = getDatasetGCUGrampus(req.DatasetInfos)
} else {
datasetGrampus, cpCommand = getDatasetGPUGrampus(req.DatasetInfos)
}
if len(req.ModelName) != 0 {
datasetGrampus = append(datasetGrampus, models.GrampusDataset{
Name: req.ModelName,


Loading…
Cancel
Save