存算联动增加曙光Ai接口
Former-commit-id: ca700f14009e660088e2688c57cc322ae7c4bd39
This commit is contained in:
parent
b36edef3cc
commit
f32a50d4b5
|
@ -0,0 +1,93 @@
|
||||||
|
package storeLink
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
||||||
|
"gitlink.org.cn/jcce-pcm/pcm-participant-ac/hpcAC"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ShuguangAi struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewShuguangAi(ctx context.Context, svcCtx *svc.ServiceContext) *ShuguangAi {
|
||||||
|
return &ShuguangAi{ctx: ctx, svcCtx: svcCtx}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShuguangAi) UploadImage(path string) (interface{}, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShuguangAi) DeleteImage(imageId string) (interface{}, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShuguangAi) QueryImageList() (interface{}, error) {
|
||||||
|
// shuguangAi获取镜像列表
|
||||||
|
req := &hpcAC.GetImageListAiReq{}
|
||||||
|
resp, err := s.svcCtx.ACRpc.GetImageListAi(s.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//转换成统一返回类型
|
||||||
|
imgListResp, err := ConvertType[hpcAC.GetImageListAiResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return imgListResp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShuguangAi) SubmitTask(imageId string, cmd string, params []string, resourceId string) (interface{}, error) {
|
||||||
|
// shuguangAi提交任务
|
||||||
|
|
||||||
|
req := &hpcAC.SubmitPytorchTaskReq{}
|
||||||
|
resp, err := s.svcCtx.ACRpc.SubmitPytorchTask(s.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//转换成统一返回类型
|
||||||
|
submitResp, err := ConvertType[hpcAC.SubmitTaskAiResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return submitResp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShuguangAi) QueryTask(taskId string) (interface{}, error) {
|
||||||
|
// shuguangAi获取任务
|
||||||
|
req := &hpcAC.GetPytorchTaskReq{}
|
||||||
|
resp, err := s.svcCtx.ACRpc.GetPytorchTask(s.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//转换成统一返回类型
|
||||||
|
taskResp, err := ConvertType[hpcAC.GetPytorchTaskResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return taskResp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShuguangAi) DeleteTask(taskId string) (interface{}, error) {
|
||||||
|
// shuguangAi删除任务
|
||||||
|
req := &hpcAC.DeleteTaskAiReq{}
|
||||||
|
resp, err := s.svcCtx.ACRpc.DeleteTaskAi(s.ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//转换成统一返回类型
|
||||||
|
deleteResp, err := ConvertType[hpcAC.DeleteTaskAiResp](resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return deleteResp, nil
|
||||||
|
}
|
2
go.mod
2
go.mod
|
@ -21,7 +21,7 @@ require (
|
||||||
github.com/shopspring/decimal v1.3.1
|
github.com/shopspring/decimal v1.3.1
|
||||||
github.com/zeromicro/go-queue v1.1.8
|
github.com/zeromicro/go-queue v1.1.8
|
||||||
github.com/zeromicro/go-zero v1.5.5
|
github.com/zeromicro/go-zero v1.5.5
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230814074259-99e24e1194d1
|
gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20231025091007-71bc3e55c141
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835
|
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20230830120334-bf6d99c715ef
|
gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20230830120334-bf6d99c715ef
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231024115530-f6fd0505d2a1
|
gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231024115530-f6fd0505d2a1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1033,8 +1033,8 @@ github.com/zeromicro/go-zero v1.4.3/go.mod h1:UmDjuW7LHd9j7+nnnPBcXF0HLNmjJw6OjH
|
||||||
github.com/zeromicro/go-zero v1.5.1/go.mod h1:bGYm4XWsGN9GhDsO2O2BngpVoWjf3Eog2a5hUOMhlXs=
|
github.com/zeromicro/go-zero v1.5.1/go.mod h1:bGYm4XWsGN9GhDsO2O2BngpVoWjf3Eog2a5hUOMhlXs=
|
||||||
github.com/zeromicro/go-zero v1.5.3 h1:9poyd+raeL7gSMUu6P19N7bssTppieR2j7Oos2j1yFQ=
|
github.com/zeromicro/go-zero v1.5.3 h1:9poyd+raeL7gSMUu6P19N7bssTppieR2j7Oos2j1yFQ=
|
||||||
github.com/zeromicro/go-zero v1.5.3/go.mod h1:dmoBpgJTxt9KWmgrNGpv06XxZRPXMakrxUVgROFAR3g=
|
github.com/zeromicro/go-zero v1.5.3/go.mod h1:dmoBpgJTxt9KWmgrNGpv06XxZRPXMakrxUVgROFAR3g=
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230814074259-99e24e1194d1 h1:eh5H8d2+YsvN6uhkwMg6UbihPEDZcU2yKpXVYE8hDE0=
|
gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20231025091007-71bc3e55c141 h1:AN+syg6txsOn5YIuY59mjGz93dPx5vpOLBo0eijO5oc=
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20230814074259-99e24e1194d1/go.mod h1:OflOWySJqYAygcwL7vT2yVtfcUs9TM3kmoD+89Tbu7c=
|
gitlink.org.cn/jcce-pcm/pcm-participant-ac v0.0.0-20231025091007-71bc3e55c141/go.mod h1:DY45tXlPBWBptj9YjCHWnAK5LshvJ33PjFkE5/vtd4o=
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835 h1:WDCPqD8IrepGJXankkpG14Ny6inh9AldB0RX9WWa+ck=
|
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835 h1:WDCPqD8IrepGJXankkpG14Ny6inh9AldB0RX9WWa+ck=
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835/go.mod h1:r/KLzUpupCV5jdxSfgDhc2pVjP0fBi3VhAWRttsBn30=
|
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835/go.mod h1:r/KLzUpupCV5jdxSfgDhc2pVjP0fBi3VhAWRttsBn30=
|
||||||
gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20230830120334-bf6d99c715ef h1:s7JfXjka2MhGaDjKMJ57fj0k3XuDB6w+UlYHFLyJlUY=
|
gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20230830120334-bf6d99c715ef h1:s7JfXjka2MhGaDjKMJ57fj0k3XuDB6w+UlYHFLyJlUY=
|
||||||
|
|
Loading…
Reference in New Issue