Browse Source

存算联动修改

Former-commit-id: d9c1cd0261
pull/9/head
tzwang 2 years ago
parent
commit
d8e4331b38
7 changed files with 39 additions and 5 deletions
  1. +9
    -2
      api/desc/storelink/pcm-storelink.api
  2. +8
    -0
      api/internal/logic/storelink/deletelinkimagelogic.go
  3. +8
    -0
      api/internal/logic/storelink/deletelinktasklogic.go
  4. +9
    -0
      api/internal/logic/storelink/getaispecslogic.go
  5. +2
    -0
      api/internal/storeLink/octopus.go
  6. +1
    -1
      go.mod
  7. +2
    -2
      go.sum

+ 9
- 2
api/desc/storelink/pcm-storelink.api View File

@@ -50,9 +50,15 @@ type (
ImageId string `json:"imageId"` ImageId string `json:"imageId"`
Cmd string `json:"cmd"` Cmd string `json:"cmd"`
Params []*ParamSl `json:"params"` Params []*ParamSl `json:"params"`
Envs []*EnvSl `json:"params"`
ResourceId string `json:"resourceId"` ResourceId string `json:"resourceId"`
} }


EnvSl {
Key string `json:"key"`
Val string `json:"value"`
}

ParamSl { ParamSl {
Key string `json:"key"` Key string `json:"key"`
Val string `json:"value"` Val string `json:"value"`
@@ -109,10 +115,11 @@ type (
GetResourceSpecsResp { GetResourceSpecsResp {
Success bool `json:"success"` Success bool `json:"success"`
ResourceSpecs []*ResourceSpecSl `json:"resourceSpecs"` ResourceSpecs []*ResourceSpecSl `json:"resourceSpecs"`
ErrorMsg string `json:"errorMsg"`
} }


ResourceSpecSl { ResourceSpecSl {
ParticipantId string `json:"participantId"`
ParticipantId int64 `json:"participantId"`
ParticipantName string `json:"participantName"` ParticipantName string `json:"participantName"`
SpecName string `json:"specName"` SpecName string `json:"specName"`
SpecId string `json:"specId"` SpecId string `json:"specId"`
@@ -120,7 +127,7 @@ type (
} }


ParticipantSl { ParticipantSl {
ParticipantId string `json:"id"`
ParticipantId int64 `json:"id"`
ParticipantName string `json:"name"` ParticipantName string `json:"name"`
ParticipantType string `json:"type"` ParticipantType string `json:"type"`
} }

+ 8
- 0
api/internal/logic/storelink/deletelinkimagelogic.go 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/storeLink"
"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/api/internal/types" "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" "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) { func (l *DeleteLinkImageLogic) DeleteLinkImage(req *types.DeleteLinkImageReq) (resp *types.DeleteLinkImageResp, err error) {
participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin) 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) storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
img, err := storelink.ILinkage.DeleteImage(req.ImageId) img, err := storelink.ILinkage.DeleteImage(req.ImageId)
if err != nil { if err != nil {


+ 8
- 0
api/internal/logic/storelink/deletelinktasklogic.go 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/storeLink"
"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/api/internal/types" "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" "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) { func (l *DeleteLinkTaskLogic) DeleteLinkTask(req *types.DeleteLinkTaskReq) (resp *types.DeleteLinkTaskResp, err error) {
participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin) 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) storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
task, err := storelink.ILinkage.DeleteTask(req.TaskId) task, err := storelink.ILinkage.DeleteTask(req.TaskId)
if err != nil { if err != nil {


+ 9
- 0
api/internal/logic/storelink/getaispecslogic.go 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/storeLink"
"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/api/internal/types" "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
"gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
) )


type GetAISpecsLogic struct { 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) { func (l *GetAISpecsLogic) GetAISpecs(req *types.GetResourceSpecsReq) (resp *types.GetResourceSpecsResp, err error) {
participant := storeLink.GetParticipantById(req.PartId, l.svcCtx.DbEngin) 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) storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, participant)
specs, err := storelink.ILinkage.QuerySpecs() specs, err := storelink.ILinkage.QuerySpecs()
if err != nil { if err != nil {


+ 2
- 0
api/internal/storeLink/octopus.go View File

@@ -120,6 +120,7 @@ func (o *OctopusLink) SubmitTask(imageId string, cmd string, params []string, re
prms = append(prms, &p) prms = append(prms, &p)
} }


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


+ 1
- 1
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-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-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-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-openstack v0.0.0-20231024105731-cbdceff549c9
gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4
gitlink.org.cn/jcce-pcm/utils v0.0.2 gitlink.org.cn/jcce-pcm/utils v0.0.2


+ 2
- 2
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-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 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-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 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-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= gitlink.org.cn/jcce-pcm/pcm-participant-slurm v0.0.0-20230714030125-a52fa198ddf4 h1:r2hBP5G/bbkPpDTPk3ENnQxD82vkoYMSeNHYhNAVRX4=


Loading…
Cancel
Save