启智章鱼获取训练作业列表接口
Former-commit-id: 1015390cf05019037492c8187a0f08aeef34f08e
This commit is contained in:
parent
f0ef1bdcd8
commit
9061f23478
|
@ -46,4 +46,5 @@ type OctopusApi struct {
|
|||
CreateTrainJob string
|
||||
GetDatasetApplyList string
|
||||
GetDatasetTypeList string
|
||||
GetTrainJobList string
|
||||
}
|
||||
|
|
|
@ -47,5 +47,5 @@ func (l *GetNotebookListLogic) GetNotebookList(in *octopus.GetNotebookListReq) (
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return &octopus.GetNotebookListResp{}, nil
|
||||
return resp, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
|
||||
"PCM/common/tool"
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
|
||||
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetTrainJobListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetTrainJobListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTrainJobListLogic {
|
||||
return &GetTrainJobListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetTrainJobListLogic) GetTrainJobList(in *octopus.GetTrainJobListReq) (*octopus.GetTrainJobListResp, error) {
|
||||
resp := &octopus.GetTrainJobListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJobList
|
||||
|
||||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetQueryString("pageIndex=" + strconv.Itoa(int(in.PageIndex))).
|
||||
SetQueryString("pageSize=" + strconv.Itoa(int(in.PageSize))).
|
||||
SetResult(resp).
|
||||
Get(reqUrl)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
|
@ -196,3 +196,8 @@ func (s *OctopusServer) CreateTrainJob(ctx context.Context, in *octopus.CreateTr
|
|||
l := logic.NewCreateTrainJobLogic(ctx, s.svcCtx)
|
||||
return l.CreateTrainJob(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) GetTrainJobList(ctx context.Context, in *octopus.GetTrainJobListReq) (*octopus.GetTrainJobListResp, error) {
|
||||
l := logic.NewGetTrainJobListLogic(ctx, s.svcCtx)
|
||||
return l.GetTrainJobList(in)
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,6 +61,7 @@ type OctopusClient interface {
|
|||
UploadImageConfirm(ctx context.Context, in *UploadImageConfirmReq, opts ...grpc.CallOption) (*UploadImageConfirmResp, error)
|
||||
// TrainJobService
|
||||
CreateTrainJob(ctx context.Context, in *CreateTrainJobReq, opts ...grpc.CallOption) (*CreateTrainJobResp, error)
|
||||
GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error)
|
||||
}
|
||||
|
||||
type octopusClient struct {
|
||||
|
@ -377,6 +378,15 @@ func (c *octopusClient) CreateTrainJob(ctx context.Context, in *CreateTrainJobRe
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error) {
|
||||
out := new(GetTrainJobListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetTrainJobList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// OctopusServer is the server API for Octopus service.
|
||||
// All implementations must embed UnimplementedOctopusServer
|
||||
// for forward compatibility
|
||||
|
@ -420,6 +430,7 @@ type OctopusServer interface {
|
|||
UploadImageConfirm(context.Context, *UploadImageConfirmReq) (*UploadImageConfirmResp, error)
|
||||
// TrainJobService
|
||||
CreateTrainJob(context.Context, *CreateTrainJobReq) (*CreateTrainJobResp, error)
|
||||
GetTrainJobList(context.Context, *GetTrainJobListReq) (*GetTrainJobListResp, error)
|
||||
mustEmbedUnimplementedOctopusServer()
|
||||
}
|
||||
|
||||
|
@ -529,6 +540,9 @@ func (UnimplementedOctopusServer) UploadImageConfirm(context.Context, *UploadIma
|
|||
func (UnimplementedOctopusServer) CreateTrainJob(context.Context, *CreateTrainJobReq) (*CreateTrainJobResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateTrainJob not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetTrainJobList(context.Context, *GetTrainJobListReq) (*GetTrainJobListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetTrainJobList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) mustEmbedUnimplementedOctopusServer() {}
|
||||
|
||||
// UnsafeOctopusServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
@ -1154,6 +1168,24 @@ func _Octopus_CreateTrainJob_Handler(srv interface{}, ctx context.Context, dec f
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetTrainJobList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetTrainJobListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetTrainJobList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetTrainJobList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetTrainJobList(ctx, req.(*GetTrainJobListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Octopus_ServiceDesc is the grpc.ServiceDesc for Octopus service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -1297,6 +1329,10 @@ var Octopus_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "CreateTrainJob",
|
||||
Handler: _Octopus_CreateTrainJob_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetTrainJobList",
|
||||
Handler: _Octopus_GetTrainJobList_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "octopus.proto",
|
||||
|
|
|
@ -74,6 +74,8 @@ type (
|
|||
GetNotebookListResp = octopus.GetNotebookListResp
|
||||
GetNotebookReq = octopus.GetNotebookReq
|
||||
GetNotebookResp = octopus.GetNotebookResp
|
||||
GetTrainJobListReq = octopus.GetTrainJobListReq
|
||||
GetTrainJobListResp = octopus.GetTrainJobListResp
|
||||
GetUserImageListReq = octopus.GetUserImageListReq
|
||||
GetUserImageListResp = octopus.GetUserImageListResp
|
||||
GiResp = octopus.GiResp
|
||||
|
@ -105,6 +107,7 @@ type (
|
|||
PayloadGetDatasetTypeList = octopus.PayloadGetDatasetTypeList
|
||||
PayloadGetDatasetVersion = octopus.PayloadGetDatasetVersion
|
||||
PayloadGetNotebook = octopus.PayloadGetNotebook
|
||||
PayloadGetTrainJobList = octopus.PayloadGetTrainJobList
|
||||
PayloadMyAlgorithmList = octopus.PayloadMyAlgorithmList
|
||||
PayloadMyDatasetList = octopus.PayloadMyDatasetList
|
||||
PayloadNotebookList = octopus.PayloadNotebookList
|
||||
|
@ -124,6 +127,7 @@ type (
|
|||
StopNotebookReq = octopus.StopNotebookReq
|
||||
StopNotebookResp = octopus.StopNotebookResp
|
||||
Tasks = octopus.Tasks
|
||||
TrainJob = octopus.TrainJob
|
||||
TrainJobOctopus = octopus.TrainJobOctopus
|
||||
UploadAlgorithmConfirmParam = octopus.UploadAlgorithmConfirmParam
|
||||
UploadAlgorithmConfirmReq = octopus.UploadAlgorithmConfirmReq
|
||||
|
@ -184,6 +188,7 @@ type (
|
|||
UploadImageConfirm(ctx context.Context, in *UploadImageConfirmReq, opts ...grpc.CallOption) (*UploadImageConfirmResp, error)
|
||||
// TrainJobService
|
||||
CreateTrainJob(ctx context.Context, in *CreateTrainJobReq, opts ...grpc.CallOption) (*CreateTrainJobResp, error)
|
||||
GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error)
|
||||
}
|
||||
|
||||
defaultOctopus struct {
|
||||
|
@ -371,3 +376,8 @@ func (m *defaultOctopus) CreateTrainJob(ctx context.Context, in *CreateTrainJobR
|
|||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.CreateTrainJob(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetTrainJobList(ctx, in, opts...)
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ message CreateMyAlgorithm{
|
|||
string algorithmName =2;
|
||||
string applyId =3;
|
||||
string frameworkId =4;
|
||||
string isEmpty =5;
|
||||
bool isEmpty =5;
|
||||
string modelName=6;
|
||||
}
|
||||
|
||||
|
@ -737,6 +737,50 @@ message PayloadUploadImageConfirm{
|
|||
/******************Model End*************************/
|
||||
|
||||
/******************TrainJobService Start*************************/
|
||||
message GetTrainJobListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetTrainJobListResp{
|
||||
bool success =1;
|
||||
PayloadGetTrainJobList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadGetTrainJobList{
|
||||
int32 totalSize = 1;
|
||||
repeated TrainJob trainJobs = 2;
|
||||
}
|
||||
|
||||
message TrainJob{
|
||||
string algorithmId = 1;
|
||||
string algorithmName = 2;
|
||||
string algorithmVersion = 3;
|
||||
int64 completedAt = 4;
|
||||
repeated Config config = 5;
|
||||
int64 createdAt = 6;
|
||||
string dataSetId = 7;
|
||||
string dataSetName = 8;
|
||||
string dataSetVersion = 9;
|
||||
string desc = 10;
|
||||
string id = 11;
|
||||
string imageId = 12;
|
||||
string imageName = 13;
|
||||
string imageUrl = 14;
|
||||
string imageVersion = 15;
|
||||
bool isDistributed = 16;
|
||||
string name = 17;
|
||||
string resourcePool = 18;
|
||||
int64 runSec = 19;
|
||||
int64 startedAt = 20;
|
||||
string status = 21;
|
||||
int64 updatedAt = 22;
|
||||
string userId = 23;
|
||||
string workspaceId = 24;
|
||||
}
|
||||
|
||||
message CreateTrainJobReq{
|
||||
string platform =1;
|
||||
CreateTrainJobParam params = 2;
|
||||
|
@ -886,6 +930,6 @@ service Octopus {
|
|||
|
||||
//TrainJobService
|
||||
rpc CreateTrainJob(CreateTrainJobReq) returns (CreateTrainJobResp);
|
||||
|
||||
rpc GetTrainJobList(GetTrainJobListReq) returns (GetTrainJobListResp);
|
||||
|
||||
}
|
Loading…
Reference in New Issue