| @@ -48,10 +48,17 @@ func (l *DeleteLinkImageLogic) DeleteLinkImage(req *types.DeleteLinkImageReq) (r | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| img, err := storelink.ILinkage.DeleteImage(req.ImageId) | img, err := storelink.ILinkage.DeleteImage(req.ImageId) | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if img == nil { | |||||
| return nil, nil | |||||
| } | |||||
| imgResp := img.(types.DeleteLinkImageResp) | imgResp := img.(types.DeleteLinkImageResp) | ||||
| return &imgResp, nil | return &imgResp, nil | ||||
| @@ -48,10 +48,17 @@ func (l *DeleteLinkTaskLogic) DeleteLinkTask(req *types.DeleteLinkTaskReq) (resp | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| task, err := storelink.ILinkage.DeleteTask(req.TaskId) | task, err := storelink.ILinkage.DeleteTask(req.TaskId) | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if task == nil { | |||||
| return nil, nil | |||||
| } | |||||
| taskResp := task.(types.DeleteLinkTaskResp) | taskResp := task.(types.DeleteLinkTaskResp) | ||||
| return &taskResp, nil | return &taskResp, nil | ||||
| @@ -48,10 +48,17 @@ func (l *GetAISpecsLogic) GetAISpecs(req *types.GetResourceSpecsReq) (resp *type | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| specs, err := storelink.ILinkage.QuerySpecs() | specs, err := storelink.ILinkage.QuerySpecs() | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if specs == nil { | |||||
| return nil, nil | |||||
| } | |||||
| specsResp := specs.(types.GetResourceSpecsResp) | specsResp := specs.(types.GetResourceSpecsResp) | ||||
| return &specsResp, nil | return &specsResp, nil | ||||
| @@ -48,10 +48,17 @@ func (l *GetLinkImageListLogic) GetLinkImageList(req *types.GetLinkImageListReq) | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| list, err := storelink.ILinkage.QueryImageList() | list, err := storelink.ILinkage.QueryImageList() | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if list == nil { | |||||
| return nil, nil | |||||
| } | |||||
| listResp := list.(types.GetLinkImageListResp) | listResp := list.(types.GetLinkImageListResp) | ||||
| return &listResp, nil | return &listResp, nil | ||||
| @@ -49,10 +49,17 @@ func (l *GetLinkTaskLogic) GetLinkTask(req *types.GetLinkTaskReq) (resp *types.G | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| task, err := storelink.ILinkage.QueryTask(req.TaskId) | task, err := storelink.ILinkage.QueryTask(req.TaskId) | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if task == nil { | |||||
| return nil, nil | |||||
| } | |||||
| taskResp := task.(types.GetLinkTaskResp) | taskResp := task.(types.GetLinkTaskResp) | ||||
| return &taskResp, nil | return &taskResp, nil | ||||
| @@ -49,6 +49,10 @@ func (l *SubmitLinkTaskLogic) SubmitLinkTask(req *types.SubmitLinkTaskReq) (resp | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| var params []string | var params []string | ||||
| if len(req.Params) != 0 { | if len(req.Params) != 0 { | ||||
| for _, v := range req.Params { | for _, v := range req.Params { | ||||
| @@ -49,10 +49,17 @@ func (l *UploadLinkImageLogic) UploadLinkImage(req *types.UploadLinkImageReq) (r | |||||
| } | } | ||||
| storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant) | ||||
| if storelink == nil { | |||||
| return nil, nil | |||||
| } | |||||
| img, err := storelink.ILinkage.UploadImage(req.FilePath) | img, err := storelink.ILinkage.UploadImage(req.FilePath) | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if img == nil { | |||||
| return nil, nil | |||||
| } | |||||
| imgResp := img.(types.UploadLinkImageResp) | imgResp := img.(types.UploadLinkImageResp) | ||||
| return &imgResp, nil | return &imgResp, nil | ||||
| @@ -2,8 +2,11 @@ package storeLink | |||||
| import ( | import ( | ||||
| "context" | "context" | ||||
| "errors" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-ac/hpcAC" | |||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc" | ||||
| "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" | "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models" | ||||
| "strings" | |||||
| ) | ) | ||||
| type ShuguangHpc struct { | type ShuguangHpc struct { | ||||
| @@ -12,28 +15,82 @@ type ShuguangHpc struct { | |||||
| participant *models.StorelinkCenter | participant *models.StorelinkCenter | ||||
| } | } | ||||
| const ( | |||||
| SHUGUANGHPC_CUSTOM_RESOURCE_ID = "10240 // 10G" | |||||
| ) | |||||
| func NewShuguangHpc(ctx context.Context, svcCtx *svc.ServiceContext, participant *models.StorelinkCenter) *ShuguangHpc { | func NewShuguangHpc(ctx context.Context, svcCtx *svc.ServiceContext, participant *models.StorelinkCenter) *ShuguangHpc { | ||||
| return &ShuguangHpc{ctx: ctx, svcCtx: svcCtx, participant: participant} | return &ShuguangHpc{ctx: ctx, svcCtx: svcCtx, participant: participant} | ||||
| } | } | ||||
| func (s ShuguangHpc) UploadImage(path string) (interface{}, error) { | func (s ShuguangHpc) UploadImage(path string) (interface{}, error) { | ||||
| //TODO implement me | |||||
| panic("implement me") | |||||
| return nil, nil | |||||
| } | } | ||||
| func (s ShuguangHpc) DeleteImage(imageId string) (interface{}, error) { | func (s ShuguangHpc) DeleteImage(imageId string) (interface{}, error) { | ||||
| //TODO implement me | |||||
| panic("implement me") | |||||
| return nil, nil | |||||
| } | } | ||||
| func (s ShuguangHpc) QueryImageList() (interface{}, error) { | func (s ShuguangHpc) QueryImageList() (interface{}, error) { | ||||
| //TODO implement me | |||||
| panic("implement me") | |||||
| return nil, nil | |||||
| } | } | ||||
| func (s ShuguangHpc) SubmitTask(imageId string, cmd string, envs []string, params []string, resourceId string) (interface{}, error) { | func (s ShuguangHpc) SubmitTask(imageId string, cmd string, envs []string, params []string, resourceId string) (interface{}, error) { | ||||
| //TODO implement me | |||||
| panic("implement me") | |||||
| // shuguangHpc提交任务 | |||||
| //判断是否resourceId匹配自定义资源Id | |||||
| if resourceId != SHUGUANGAI_CUSTOM_RESOURCE_ID { | |||||
| return nil, errors.New("shuguangHpc资源Id不存在") | |||||
| } | |||||
| //环境变量 | |||||
| var env string | |||||
| for _, e := range envs { | |||||
| s := strings.Split(e, COMMA) | |||||
| env += s[0] + "=" + s[1] + SPACE | |||||
| } | |||||
| //请求 | |||||
| req := &hpcAC.SubmitJobReq{ | |||||
| Apptype: "", | |||||
| Appname: "", | |||||
| StrJobManagerID: 0, | |||||
| MapAppJobInfo: &hpcAC.MapAppJobInfo{ | |||||
| GAP_CMD_FILE: "echo $TESTDIR; echo $TESTENV; sleep 30", | |||||
| GAP_NNODE: "1", | |||||
| GAP_NODE_STRING: "", | |||||
| GAP_SUBMIT_TYPE: "cmd", | |||||
| GAP_JOB_NAME: "testSlurmjob1", | |||||
| GAP_WORK_DIR: "/work/home/acgnnmfbwo/BASE/testSlurmjob1", | |||||
| GAP_QUEUE: "wzhdtest", | |||||
| GAP_NPROC: "1", | |||||
| GAP_PPN: "", | |||||
| GAP_NGPU: "", | |||||
| GAP_NDCU: "1", | |||||
| GAP_WALL_TIME: "01:00:00", | |||||
| GAP_EXCLUSIVE: "", | |||||
| GAP_APPNAME: "BASE", | |||||
| GAP_MULTI_SUB: "", | |||||
| GAP_STD_OUT_FILE: "/work/home/acgnnmfbwo/BASE/testSlurmjob1/std.out.%j", | |||||
| GAP_STD_ERR_FILE: "/work/home/acgnnmfbwo/BASE/testSlurmjob1/std.err.%j", | |||||
| GAP_SCHEDULER_OPT_WEB: "export TESTDIR=/bin/emacs\nexport TESTENV=12345", | |||||
| }, | |||||
| } | |||||
| resp, err := s.svcCtx.ACRpc.SubmitJob(s.ctx, req) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| //转换成统一返回类型 | |||||
| submitResp, err := ConvertType[hpcAC.SubmitJobResp](resp, nil) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return submitResp, nil | |||||
| } | } | ||||
| func (s ShuguangHpc) QueryTask(taskId string) (interface{}, error) { | func (s ShuguangHpc) QueryTask(taskId string) (interface{}, error) { | ||||
| @@ -23,7 +23,7 @@ require ( | |||||
| github.com/rs/zerolog v1.28.0 | github.com/rs/zerolog v1.28.0 | ||||
| github.com/shopspring/decimal v1.3.1 | github.com/shopspring/decimal v1.3.1 | ||||
| github.com/zeromicro/go-zero v1.6.0 | github.com/zeromicro/go-zero v1.6.0 | ||||
| gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20231108025612-8f0044dd7a95 | |||||
| gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20231207021053-376383ea3c38 | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d | gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231128034759-01d57082e120 | gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231128034759-01d57082e120 | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231101085149-724c7c4cc090 | gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231101085149-724c7c4cc090 | ||||
| @@ -996,8 +996,8 @@ github.com/yuin/gopher-lua v1.1.0/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7 | |||||
| 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.6.0 h1:UwSOR1lGZ2g7L0S07PM8RoneAcubtd5x//EfbuNucQ0= | github.com/zeromicro/go-zero v1.6.0 h1:UwSOR1lGZ2g7L0S07PM8RoneAcubtd5x//EfbuNucQ0= | ||||
| github.com/zeromicro/go-zero v1.6.0/go.mod h1:E9GCFPb0SwsTKFBcFr9UynGvXiDMmfc6fI5F15vqvAQ= | github.com/zeromicro/go-zero v1.6.0/go.mod h1:E9GCFPb0SwsTKFBcFr9UynGvXiDMmfc6fI5F15vqvAQ= | ||||
| gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20231108025612-8f0044dd7a95 h1:63M79RcLdA1eXXOkDF6DSI46cWdBR6W/EcMvzo9yku0= | |||||
| gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20231108025612-8f0044dd7a95/go.mod h1:ySZHK8NpHn4gjbLoOtJbSEUDiYZVwjbnFAcG71gXPgg= | |||||
| gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20231207021053-376383ea3c38 h1:tKVL4JcF1P+rntJd4hFg+MtVgsGmyhnisEaME8tF7J0= | |||||
| gitlink.org.cn/jcce-pcm/pcm-ac v0.0.0-20231207021053-376383ea3c38/go.mod h1:ySZHK8NpHn4gjbLoOtJbSEUDiYZVwjbnFAcG71gXPgg= | |||||
| gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d h1:DHjl/rLuH2gKYtY0MKMGNQDHFT12APg25RlMUQo+tHk= | gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d h1:DHjl/rLuH2gKYtY0MKMGNQDHFT12APg25RlMUQo+tHk= | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d/go.mod h1:r/KLzUpupCV5jdxSfgDhc2pVjP0fBi3VhAWRttsBn30= | gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d/go.mod h1:r/KLzUpupCV5jdxSfgDhc2pVjP0fBi3VhAWRttsBn30= | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231128034759-01d57082e120 h1:4mUD/FW+i948cpTI9faCgnIUItZW3eoA1UdPsDnzK1M= | gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231128034759-01d57082e120 h1:4mUD/FW+i948cpTI9faCgnIUItZW3eoA1UdPsDnzK1M= | ||||