|
|
|
@@ -508,6 +508,8 @@ func (o *OctopusLink) GetTrainingTask(ctx context.Context, taskId string) (*coll |
|
|
|
task.Status = constants.Running |
|
|
|
case "stopped": |
|
|
|
task.Status = constants.Stopped |
|
|
|
case "pending": |
|
|
|
task.Status = constants.Pending |
|
|
|
default: |
|
|
|
task.Status = "undefined" |
|
|
|
} |
|
|
|
@@ -585,7 +587,7 @@ func (o *OctopusLink) generateResourceId(ctx context.Context, option *option.AiO |
|
|
|
} |
|
|
|
|
|
|
|
if option.ResourceType == CARD { |
|
|
|
err = setResourceIdByCard(option, specResp, GCU) |
|
|
|
err = setResourceIdByCard(option, specResp, option.ComputeCard) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
@@ -662,9 +664,22 @@ func (o *OctopusLink) generateImageId(ctx context.Context, option *option.AiOpti |
|
|
|
|
|
|
|
if option.ResourceType == CARD { |
|
|
|
for _, image := range preImgResp.Payload.Images { |
|
|
|
if strings.Contains(image.ImageName, cardAliasMap[option.ComputeCard]) { |
|
|
|
option.ImageId = image.Id |
|
|
|
return nil |
|
|
|
if strings.Contains(image.ImageName, cardAliasMap[strings.ToUpper(option.ComputeCard)]) { |
|
|
|
switch strings.ToUpper(option.ComputeCard) { |
|
|
|
case GCU: |
|
|
|
if strings.HasPrefix(image.ImageVersion, "t20_") { |
|
|
|
option.ImageId = image.Id |
|
|
|
return nil |
|
|
|
} |
|
|
|
case BIV100: |
|
|
|
if strings.HasPrefix(image.ImageVersion, "bi_") { |
|
|
|
option.ImageId = image.Id |
|
|
|
return nil |
|
|
|
} |
|
|
|
case MLU: |
|
|
|
option.ImageId = image.Id |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -750,7 +765,7 @@ func setResourceIdByCard(option *option.AiOption, specs *octopus.GetResourceSpec |
|
|
|
if spec.Price == 1 { |
|
|
|
ns := strings.Split(spec.Name, COMMA) |
|
|
|
cardSpecs := strings.Split(ns[0], STAR) |
|
|
|
if cardSpecs[1] == cardCnMap[computeCard] { |
|
|
|
if cardSpecs[1] == cardCnMap[strings.ToUpper(computeCard)] { |
|
|
|
option.ResourceId = spec.Id |
|
|
|
option.ComputeCard = computeCard |
|
|
|
return nil |
|
|
|
@@ -766,7 +781,7 @@ func setResourceIdByCard(option *option.AiOption, specs *octopus.GetResourceSpec |
|
|
|
if spec.Price == 1 { |
|
|
|
ns := strings.Split(spec.Name, COMMA) |
|
|
|
cardSpecs := strings.Split(ns[0], STAR) |
|
|
|
if cardSpecs[1] == cardCnMap[computeCard] { |
|
|
|
if cardSpecs[1] == cardCnMap[strings.ToUpper(computeCard)] { |
|
|
|
option.ResourceId = spec.Id |
|
|
|
option.ComputeCard = computeCard |
|
|
|
return nil |
|
|
|
@@ -780,7 +795,7 @@ func setResourceIdByCard(option *option.AiOption, specs *octopus.GetResourceSpec |
|
|
|
continue |
|
|
|
} |
|
|
|
cardSpecs := strings.Split(ns[0], STAR) |
|
|
|
if cardSpecs[1] != cardCnMap[computeCard] { |
|
|
|
if cardSpecs[1] != cardCnMap[strings.ToUpper(computeCard)] { |
|
|
|
continue |
|
|
|
} |
|
|
|
s, err := strconv.ParseFloat(cardSpecs[0], 64) |
|
|
|
|