modified octopus submit options
Former-commit-id: 96d68b07d16acad26c8d853e54abe6d2e6e3f1bc
This commit is contained in:
parent
efdf09649d
commit
40bb2d8f04
|
@ -46,7 +46,7 @@ const (
|
||||||
SAILINGSI = "sailingsi"
|
SAILINGSI = "sailingsi"
|
||||||
MLU = "MLU"
|
MLU = "MLU"
|
||||||
CAMBRICONMLU290 = 256
|
CAMBRICONMLU290 = 256
|
||||||
GCU = "GCU"
|
GCU = "enflame"
|
||||||
EnflameT20 = 128
|
EnflameT20 = 128
|
||||||
BASE_TOPS = 128
|
BASE_TOPS = 128
|
||||||
CAMBRICON = "cambricon"
|
CAMBRICON = "cambricon"
|
||||||
|
@ -293,6 +293,10 @@ func (o *OctopusLink) GenerateSubmitParams(option *option.AiOption) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
err = o.generateAlgorithmId(option)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
err = o.generateCmd(option)
|
err = o.generateCmd(option)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -457,19 +461,42 @@ func (o *OctopusLink) generateImageId(option *option.AiOption) error {
|
||||||
if option.TaskType == "" {
|
if option.TaskType == "" {
|
||||||
return errors.New("TaskType not set")
|
return errors.New("TaskType not set")
|
||||||
}
|
}
|
||||||
req := &octopus.GetPresetImageListReq{
|
|
||||||
|
req := &octopus.GetUserImageListReq{
|
||||||
Platform: o.platform,
|
Platform: o.platform,
|
||||||
PageIndex: o.pageIndex,
|
PageIndex: o.pageIndex,
|
||||||
PageSize: o.pageSize,
|
PageSize: o.pageSize,
|
||||||
}
|
}
|
||||||
resp, err := o.svcCtx.OctopusRpc.GetPresetImageList(o.ctx, req)
|
resp, err := o.svcCtx.OctopusRpc.GetUserImageList(o.ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !resp.Success {
|
if !resp.Success {
|
||||||
|
return errors.New("failed to get imageId")
|
||||||
|
}
|
||||||
|
|
||||||
|
if option.ResourceType == CPU {
|
||||||
|
for _, img := range resp.Payload.Images {
|
||||||
|
if img.Image.ImageName == "test-image" {
|
||||||
|
option.ImageId = img.Image.Id
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
preImgReq := &octopus.GetPresetImageListReq{
|
||||||
|
Platform: o.platform,
|
||||||
|
PageIndex: o.pageIndex,
|
||||||
|
PageSize: o.pageSize,
|
||||||
|
}
|
||||||
|
preImgResp, err := o.svcCtx.OctopusRpc.GetPresetImageList(o.ctx, preImgReq)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !preImgResp.Success {
|
||||||
return errors.New("failed to get PresetImages")
|
return errors.New("failed to get PresetImages")
|
||||||
}
|
}
|
||||||
for _, image := range resp.Payload.Images {
|
for _, image := range preImgResp.Payload.Images {
|
||||||
if strings.Contains(image.ImageName, option.TaskType) && strings.Contains(image.ImageName, cardAliasMap[option.ComputeCard]) {
|
if strings.Contains(image.ImageName, option.TaskType) && strings.Contains(image.ImageName, cardAliasMap[option.ComputeCard]) {
|
||||||
option.ImageId = image.Id
|
option.ImageId = image.Id
|
||||||
return nil
|
return nil
|
||||||
|
@ -478,6 +505,30 @@ func (o *OctopusLink) generateImageId(option *option.AiOption) error {
|
||||||
return errors.New("failed to get ImageId")
|
return errors.New("failed to get ImageId")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *OctopusLink) generateAlgorithmId(option *option.AiOption) error {
|
||||||
|
req := &octopus.GetMyAlgorithmListReq{
|
||||||
|
Platform: o.platform,
|
||||||
|
PageIndex: o.pageIndex,
|
||||||
|
PageSize: o.pageSize,
|
||||||
|
}
|
||||||
|
resp, err := o.svcCtx.OctopusRpc.GetMyAlgorithmList(o.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if !resp.Success {
|
||||||
|
return errors.New("failed to get algorithmId")
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, algorithm := range resp.Payload.Algorithms {
|
||||||
|
if algorithm.FrameworkName == strings.Title(option.TaskType) && strings.Contains(algorithm.AlgorithmName, option.DatasetsName) {
|
||||||
|
option.AlgorithmId = algorithm.AlgorithmId
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (o *OctopusLink) generateCmd(option *option.AiOption) error {
|
func (o *OctopusLink) generateCmd(option *option.AiOption) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue