modified octopus functions generateAlgorithmId
Former-commit-id: 0440af0e370819df4d58399d89574ac29c62c44f
This commit is contained in:
parent
32bee79af3
commit
6f181c313a
|
@ -341,11 +341,10 @@ func (o *OctopusLink) generateResourceId(option *option.AiOption) error {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if option.ResourceType == CARD {
|
||||
err = setResourceIdByCard(option, specResp, MLU)
|
||||
err = setResourceIdByCard(option, specResp, GCU)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -418,16 +417,23 @@ func (o *OctopusLink) generateImageId(option *option.AiOption) error {
|
|||
if !preImgResp.Success {
|
||||
return errors.New("failed to get PresetImages")
|
||||
}
|
||||
for _, image := range preImgResp.Payload.Images {
|
||||
if strings.Contains(image.ImageName, option.TaskType) && strings.Contains(image.ImageName, cardAliasMap[option.ComputeCard]) {
|
||||
option.ImageId = image.Id
|
||||
return nil
|
||||
|
||||
if option.ResourceType == CARD {
|
||||
for _, image := range preImgResp.Payload.Images {
|
||||
if strings.Contains(image.ImageName, cardAliasMap[option.ComputeCard]) {
|
||||
option.ImageId = image.Id
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors.New("failed to get ImageId")
|
||||
}
|
||||
|
||||
func (o *OctopusLink) generateAlgorithmId(option *option.AiOption) error {
|
||||
// temporarily set algorithm to cnn
|
||||
option.AlgorithmName = "cnn"
|
||||
|
||||
req := &octopus.GetMyAlgorithmListReq{
|
||||
Platform: o.platform,
|
||||
PageIndex: o.pageIndex,
|
||||
|
@ -442,18 +448,33 @@ func (o *OctopusLink) generateAlgorithmId(option *option.AiOption) error {
|
|||
}
|
||||
|
||||
for _, algorithm := range resp.Payload.Algorithms {
|
||||
if algorithm.FrameworkName == strings.Title(option.TaskType) && strings.Contains(algorithm.AlgorithmName, option.DatasetsName) {
|
||||
if algorithm.FrameworkName == strings.Title(option.TaskType) {
|
||||
ns := strings.Split(algorithm.AlgorithmName, DASH)
|
||||
if ns[0] != option.DatasetsName {
|
||||
continue
|
||||
}
|
||||
if ns[1] != option.AlgorithmName {
|
||||
continue
|
||||
}
|
||||
if ns[2] != option.ResourceType {
|
||||
continue
|
||||
}
|
||||
option.AlgorithmId = algorithm.AlgorithmId
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
return errors.New("failed to get AlgorithmId")
|
||||
}
|
||||
|
||||
func (o *OctopusLink) generateCmd(option *option.AiOption) error {
|
||||
if option.Cmd == "" {
|
||||
option.Cmd = TRAIN_CMD
|
||||
switch option.ComputeCard {
|
||||
case GCU:
|
||||
option.Cmd = "cd /code; python3 train.py"
|
||||
default:
|
||||
option.Cmd = TRAIN_CMD
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue