存算联动修改

This commit is contained in:
tzwang 2023-11-01 17:37:02 +08:00
parent afd3152161
commit d9c1cd0261
7 changed files with 39 additions and 5 deletions

View File

@ -50,9 +50,15 @@ type (
ImageId string `json:"imageId"`
Cmd string `json:"cmd"`
Params []*ParamSl `json:"params"`
Envs []*EnvSl `json:"params"`
ResourceId string `json:"resourceId"`
}
EnvSl {
Key string `json:"key"`
Val string `json:"value"`
}
ParamSl {
Key string `json:"key"`
Val string `json:"value"`
@ -109,10 +115,11 @@ type (
GetResourceSpecsResp {
Success bool `json:"success"`
ResourceSpecs []*ResourceSpecSl `json:"resourceSpecs"`
ErrorMsg string `json:"errorMsg"`
}
ResourceSpecSl {
ParticipantId string `json:"participantId"`
ParticipantId int64 `json:"participantId"`
ParticipantName string `json:"participantName"`
SpecName string `json:"specName"`
SpecId string `json:"specId"`
@ -120,7 +127,7 @@ type (
}
ParticipantSl {
ParticipantId string `json:"id"`
ParticipantId int64 `json:"id"`
ParticipantName string `json:"name"`
ParticipantType string `json:"type"`
}

View File

@ -5,6 +5,7 @@ import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"github.com/zeromicro/go-zero/core/logx"
)
@ -25,6 +26,13 @@ func NewDeleteLinkImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *D
func (l *DeleteLinkImageLogic) DeleteLinkImage(req *types.DeleteLinkImageReq) (resp *types.DeleteLinkImageResp, err error) {
participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin)
if *participant == (models.StorelinkCenter{}) {
resp = &types.DeleteLinkImageResp{}
resp.Success = false
resp.ErrorMsg = "partId不存在"
return resp, nil
}
storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
img, err := storelink.ILinkage.DeleteImage(req.ImageId)
if err != nil {

View File

@ -5,6 +5,7 @@ import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
"github.com/zeromicro/go-zero/core/logx"
)
@ -25,6 +26,13 @@ func NewDeleteLinkTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *De
func (l *DeleteLinkTaskLogic) DeleteLinkTask(req *types.DeleteLinkTaskReq) (resp *types.DeleteLinkTaskResp, err error) {
participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin)
if *participant == (models.StorelinkCenter{}) {
resp = &types.DeleteLinkTaskResp{}
resp.Success = false
resp.ErrorMsg = "partId不存在"
return resp, nil
}
storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
task, err := storelink.ILinkage.DeleteTask(req.TaskId)
if err != nil {

View File

@ -6,6 +6,7 @@ import (
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
)
type GetAISpecsLogic struct {
@ -24,6 +25,14 @@ func NewGetAISpecsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAIS
func (l *GetAISpecsLogic) GetAISpecs(req *types.GetResourceSpecsReq) (resp *types.GetResourceSpecsResp, err error) {
participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin)
if *participant == (models.StorelinkCenter{}) {
resp = &types.GetResourceSpecsResp{}
resp.Success = false
resp.ResourceSpecs = nil
resp.ErrorMsg = "partId不存在"
return resp, nil
}
storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
specs, err := storelink.ILinkage.QuerySpecs()
if err != nil {

View File

@ -120,6 +120,7 @@ func (o *OctopusLink) SubmitTask(imageId string, cmd string, params []string, re
prms = append(prms, &p)
}
var str string
req := &octopus.CreateTrainJobReq{
Platform: o.participant.Name,
Params: &octopus.CreateTrainJobParam{
@ -134,6 +135,7 @@ func (o *OctopusLink) SubmitTask(imageId string, cmd string, params []string, re
MinSucceededTaskCount: 1,
TaskNumber: 1,
Parameters: prms,
Envs: str,
},
},
},

2
go.mod
View File

@ -27,7 +27,7 @@ require (
gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230817103341-2459e5bfc835
gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231027083610-c8a292768f4a
gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231024115530-f6fd0505d2a1
gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4
gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231101091522-38307e241dfd
gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20231024105731-cbdceff549c9
gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4
gitlink.org.cn/jcce-pcm/utils v0.0.2

4
go.sum
View File

@ -1041,8 +1041,8 @@ gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231027083610-c8a2927
gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes v0.0.0-20231027083610-c8a292768f4a/go.mod h1:xtSfvDUd+jJhqHBBibZ1d9/ud3oN9nxaNYYHwz+CDgY=
gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231024115530-f6fd0505d2a1 h1:4Ibzcl4waYiHO3tdbqvcLUWEoV51ZaJhZBi7T518AA8=
gitlink.org.cn/jcce-pcm/pcm-participant-modelarts v0.0.0-20231024115530-f6fd0505d2a1/go.mod h1:pisJKAI8FRFFUcBaH3Gob+ENXWRM97rpuYmv9s1raag=
gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4 h1:iv78VZ5+j6/VNkEyD/GSmTJ96rpxzpKDUNknAoXsAmg=
gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231011071802-c6a7637b74e4/go.mod h1:uyvpVqG1jHDXX+ubXI0RBwnWXzVykD/mliqGQIDvRoo=
gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231101091522-38307e241dfd h1:9GIKpN6nel4U5jD91HL/vjzwo+EHTpE13SkT7WKyXtQ=
gitlink.org.cn/jcce-pcm/pcm-participant-octopus v0.0.0-20231101091522-38307e241dfd/go.mod h1:uyvpVqG1jHDXX+ubXI0RBwnWXzVykD/mliqGQIDvRoo=
gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20231024105731-cbdceff549c9 h1:r352e/Vrnity+BgrWyWCgn8uT2xPg6O86g+H4aIOdX8=
gitlink.org.cn/jcce-pcm/pcm-participant-openstack v0.0.0-20231024105731-cbdceff549c9/go.mod h1:m75SVNfNa1TUBlQtBfR0CeETQ0ez2RIUqlSCn1Mb/js=
gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 h1:r2hBP5G/bbkPpDTPk3ENnQxD82vkoYMSeNHYhNAVRX4=