存算联动接口更新
Former-commit-id: 7943b0ac9a9252d7f3f7a3ef713cf7c1be3cb84c
This commit is contained in:
parent
64a9af73c4
commit
2674a18ad6
|
@ -314,4 +314,10 @@ service pcm {
|
||||||
|
|
||||||
@handler DeleteLinkTaskHandler
|
@handler DeleteLinkTaskHandler
|
||||||
delete /storelink/deleteTask (DeleteLinkTaskReq) returns (DeleteLinkTaskResp)
|
delete /storelink/deleteTask (DeleteLinkTaskReq) returns (DeleteLinkTaskResp)
|
||||||
|
|
||||||
|
@handler GetParticipantsHandler
|
||||||
|
get /storelink/getParticipants (GetParticipantsReq) returns (GetParticipantsResp)
|
||||||
|
|
||||||
|
@handler GetAISpecsHandler
|
||||||
|
get /storelink/getResourceSpecs (GetResourceSpecsReq) returns (GetResourceSpecsResp)
|
||||||
}
|
}
|
|
@ -93,4 +93,20 @@ type (
|
||||||
StartedAt int64 `json:"startedAt"`
|
StartedAt int64 `json:"startedAt"`
|
||||||
CompletedAt int64 `json:"completedAt"`
|
CompletedAt int64 `json:"completedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetParticipantsReq {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GetParticipantsResp {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GetResourceSpecsReq {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GetResourceSpecsResp {
|
||||||
|
|
||||||
|
}
|
||||||
)
|
)
|
|
@ -3,6 +3,7 @@ package storeLink
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"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/utils"
|
||||||
"gitlink.org.cn/jcce-pcm/pcm-participant-octopus/octopus"
|
"gitlink.org.cn/jcce-pcm/pcm-participant-octopus/octopus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ type OctopusLink struct {
|
||||||
const (
|
const (
|
||||||
IMG_NAME_PREFIX = "oct_"
|
IMG_NAME_PREFIX = "oct_"
|
||||||
IMG_VERSION_PREFIX = "version_"
|
IMG_VERSION_PREFIX = "version_"
|
||||||
|
TASK_NAME_PREFIX = "trainJob_"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewOctopusLink(ctx context.Context, svcCtx *svc.ServiceContext, platform string) *OctopusLink {
|
func NewOctopusLink(ctx context.Context, svcCtx *svc.ServiceContext, platform string) *OctopusLink {
|
||||||
|
@ -28,8 +30,8 @@ func (o *OctopusLink) UploadImage(path string) (interface{}, error) {
|
||||||
Platform: o.platform,
|
Platform: o.platform,
|
||||||
CreateImage: &octopus.CreateImage{
|
CreateImage: &octopus.CreateImage{
|
||||||
SourceType: 1,
|
SourceType: 1,
|
||||||
//ImageName: IMG_NAME_PREFIX + utils.RandomString(5),
|
ImageName: IMG_NAME_PREFIX + utils.RandomString(5),
|
||||||
//ImageVersion: IMG_VERSION_PREFIX + utils.RandomString(7),
|
ImageVersion: IMG_VERSION_PREFIX + utils.RandomString(7),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
createResp, err := o.svcCtx.OctopusRpc.CreateImage(o.ctx, createReq)
|
createResp, err := o.svcCtx.OctopusRpc.CreateImage(o.ctx, createReq)
|
||||||
|
@ -39,7 +41,10 @@ func (o *OctopusLink) UploadImage(path string) (interface{}, error) {
|
||||||
uploadReq := &octopus.UploadImageReq{
|
uploadReq := &octopus.UploadImageReq{
|
||||||
Platform: o.platform,
|
Platform: o.platform,
|
||||||
ImageId: createResp.Payload.ImageId,
|
ImageId: createResp.Payload.ImageId,
|
||||||
Params: &octopus.UploadImageParam{},
|
Params: &octopus.UploadImageParam{
|
||||||
|
Domain: "",
|
||||||
|
FileName: "",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
uploadResp, err := o.svcCtx.OctopusRpc.UploadImage(o.ctx, uploadReq)
|
uploadResp, err := o.svcCtx.OctopusRpc.UploadImage(o.ctx, uploadReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -94,7 +99,20 @@ func (o *OctopusLink) QueryImageList() (interface{}, error) {
|
||||||
func (o *OctopusLink) SubmitTask(imageId string, cmd string, envs []string) (interface{}, error) {
|
func (o *OctopusLink) SubmitTask(imageId string, cmd string, envs []string) (interface{}, error) {
|
||||||
req := &octopus.CreateTrainJobReq{
|
req := &octopus.CreateTrainJobReq{
|
||||||
Platform: o.platform,
|
Platform: o.platform,
|
||||||
Params: &octopus.CreateTrainJobParam{},
|
Params: &octopus.CreateTrainJobParam{
|
||||||
|
ImageId: imageId,
|
||||||
|
Name: TASK_NAME_PREFIX + utils.RandomString(5),
|
||||||
|
ResourcePool: "common-pool",
|
||||||
|
Config: []*octopus.Config{
|
||||||
|
{
|
||||||
|
Command: cmd,
|
||||||
|
ResourceSpecId: "6388d3c27f654fa5b11439a3d6098dbc",
|
||||||
|
MinFailedTaskCount: 1,
|
||||||
|
MinSucceededTaskCount: 1,
|
||||||
|
TaskNumber: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
resp, err := o.svcCtx.OctopusRpc.CreateTrainJob(o.ctx, req)
|
resp, err := o.svcCtx.OctopusRpc.CreateTrainJob(o.ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue