|
|
|
@@ -73,7 +73,7 @@ type GenerateTrainJobReq struct { |
|
|
|
func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error) { |
|
|
|
createTime := timeutil.TimeStampNow() |
|
|
|
|
|
|
|
CenterID, CenterName := getCentersParamter(ctx, req) |
|
|
|
centerID, centerName := getCentersParamter(ctx, req) |
|
|
|
|
|
|
|
jobResult, err := createJob(models.CreateGrampusJobRequest{ |
|
|
|
Name: req.JobName, |
|
|
|
@@ -84,8 +84,8 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error |
|
|
|
ResourceSpecId: req.ResourceSpecId, |
|
|
|
ImageId: req.ImageId, |
|
|
|
ImageUrl: req.ImageUrl, |
|
|
|
CenterID: CenterID, |
|
|
|
CenterName: CenterName, |
|
|
|
CenterID: centerID, |
|
|
|
CenterName: centerName, |
|
|
|
ReplicaNum: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
@@ -144,8 +144,8 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error |
|
|
|
} |
|
|
|
|
|
|
|
func getCentersParamter(ctx *context.Context, req *GenerateTrainJobReq) ([]string, []string) { |
|
|
|
var CenterID []string |
|
|
|
var CenterName []string |
|
|
|
var centerID []string |
|
|
|
var centerName []string |
|
|
|
|
|
|
|
includeCenters := make(map[string]string) |
|
|
|
excludeCenters := make(map[string]string) |
|
|
|
@@ -174,8 +174,8 @@ func getCentersParamter(ctx *context.Context, req *GenerateTrainJobReq) ([]strin |
|
|
|
if len(includeCenters) > 0 { |
|
|
|
//如果有专属资源池,根据专属资源池指定智算中心 |
|
|
|
for k, v := range includeCenters { |
|
|
|
CenterID = append(CenterID, k) |
|
|
|
CenterName = append(CenterName, v) |
|
|
|
centerID = append(centerID, k) |
|
|
|
centerName = append(centerName, v) |
|
|
|
} |
|
|
|
} else if len(excludeCenters) > 0 { |
|
|
|
//否则,有要排除的中心,先获取所有中心,删除其中的排除中心,得到指定的智算中心 |
|
|
|
@@ -195,12 +195,12 @@ func getCentersParamter(ctx *context.Context, req *GenerateTrainJobReq) ([]strin |
|
|
|
} |
|
|
|
|
|
|
|
for k, v := range allCenters { |
|
|
|
CenterID = append(CenterID, k) |
|
|
|
CenterName = append(CenterName, v) |
|
|
|
centerID = append(centerID, k) |
|
|
|
centerName = append(centerName, v) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return CenterID, CenterName |
|
|
|
return centerID, centerName |
|
|
|
} |
|
|
|
|
|
|
|
func TransTrainJobStatus(status string) string { |
|
|
|
|