octopus 添加我的算法列表接口,notebook列表接口
This commit is contained in:
parent
711454c41c
commit
3cdbbf1239
|
@ -45,11 +45,5 @@ func getConfig() Config {
|
|||
// 注册到nacos
|
||||
nacosConfig.Discovery(&c.RpcServerConf)
|
||||
|
||||
//OctopusUrls = map[string]string{
|
||||
// common.Hanwuji: c.OctopusConfig.HanwujiUrl,
|
||||
// common.Suiyuan: c.OctopusConfig.SuiyuanUrl,
|
||||
// common.Sailingsi: c.OctopusConfig.SailingsiUrl,
|
||||
//}
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
@ -15,4 +15,6 @@ type OctopusConfig struct {
|
|||
|
||||
type OctopusApi struct {
|
||||
GetUserImageList string
|
||||
GetMyAlgorithmList string
|
||||
GetNotebookList string
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
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 GetMyAlgorithmListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetMyAlgorithmListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyAlgorithmListLogic {
|
||||
return &GetMyAlgorithmListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// Algorithm
|
||||
func (l *GetMyAlgorithmListLogic) GetMyAlgorithmList(in *octopus.GetMyAlgorithmListReq) (*octopus.GetMyAlgorithmListResp, error) {
|
||||
resp := &octopus.GetMyAlgorithmListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMyAlgorithmList
|
||||
|
||||
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
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
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 GetNotebookListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetNotebookListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNotebookListLogic {
|
||||
return &GetNotebookListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (l *GetNotebookListLogic) GetNotebookList(in *octopus.GetNotebookListReq) (*octopus.GetNotebookListResp, error) {
|
||||
resp := &octopus.GetNotebookListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetNotebookList
|
||||
|
||||
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 &octopus.GetNotebookListResp{}, nil
|
||||
}
|
|
@ -35,7 +35,7 @@ func (l *GetUserImageListLogic) GetUserImageList(in *octopus.GetUserImageListReq
|
|||
token := common.GetToken(in.Platform)
|
||||
|
||||
req := tool.GetACHttpRequest()
|
||||
_, err := /*req.SetHeader(tool.ContentType, tool.ApplicationJson).*/ req.
|
||||
_, err := req.
|
||||
SetHeader("Authorization", "Bearer "+token).
|
||||
SetQueryString("pageIndex=" + strconv.Itoa(int(in.PageIndex))).
|
||||
SetQueryString("pageSize=" + strconv.Itoa(int(in.PageSize))).
|
||||
|
|
|
@ -37,6 +37,18 @@ func (s *OctopusServer) CreateDataSet(ctx context.Context, in *octopus.CreateDat
|
|||
return l.CreateDataSet(in)
|
||||
}
|
||||
|
||||
// Algorithm
|
||||
func (s *OctopusServer) GetMyAlgorithmList(ctx context.Context, in *octopus.GetMyAlgorithmListReq) (*octopus.GetMyAlgorithmListResp, error) {
|
||||
l := logic.NewGetMyAlgorithmListLogic(ctx, s.svcCtx)
|
||||
return l.GetMyAlgorithmList(in)
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (s *OctopusServer) GetNotebookList(ctx context.Context, in *octopus.GetNotebookListReq) (*octopus.GetNotebookListResp, error) {
|
||||
l := logic.NewGetNotebookListLogic(ctx, s.svcCtx)
|
||||
return l.GetNotebookList(in)
|
||||
}
|
||||
|
||||
// ImageService
|
||||
func (s *OctopusServer) GetUserImageList(ctx context.Context, in *octopus.GetUserImageListReq) (*octopus.GetUserImageListResp, error) {
|
||||
l := logic.NewGetUserImageListLogic(ctx, s.svcCtx)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,11 @@ type OctopusClient interface {
|
|||
GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error)
|
||||
GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error)
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// Algorithm
|
||||
GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error)
|
||||
// ModelDeployService
|
||||
// Develop
|
||||
GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error)
|
||||
}
|
||||
|
@ -64,6 +69,24 @@ func (c *octopusClient) CreateDataSet(ctx context.Context, in *CreateDataSetReq,
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error) {
|
||||
out := new(GetMyAlgorithmListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetMyAlgorithmList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error) {
|
||||
out := new(GetNotebookListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetNotebookList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error) {
|
||||
out := new(GetUserImageListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetUserImageList", in, out, opts...)
|
||||
|
@ -80,6 +103,11 @@ type OctopusServer interface {
|
|||
GetComputingPower(context.Context, *ResourceReq) (*CpResp, error)
|
||||
GetGeneralInfo(context.Context, *ResourceReq) (*GiResp, error)
|
||||
CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error)
|
||||
// Algorithm
|
||||
GetMyAlgorithmList(context.Context, *GetMyAlgorithmListReq) (*GetMyAlgorithmListResp, error)
|
||||
// ModelDeployService
|
||||
// Develop
|
||||
GetNotebookList(context.Context, *GetNotebookListReq) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
GetUserImageList(context.Context, *GetUserImageListReq) (*GetUserImageListResp, error)
|
||||
mustEmbedUnimplementedOctopusServer()
|
||||
|
@ -98,6 +126,12 @@ func (UnimplementedOctopusServer) GetGeneralInfo(context.Context, *ResourceReq)
|
|||
func (UnimplementedOctopusServer) CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateDataSet not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetMyAlgorithmList(context.Context, *GetMyAlgorithmListReq) (*GetMyAlgorithmListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMyAlgorithmList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetNotebookList(context.Context, *GetNotebookListReq) (*GetNotebookListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetNotebookList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetUserImageList(context.Context, *GetUserImageListReq) (*GetUserImageListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserImageList not implemented")
|
||||
}
|
||||
|
@ -168,6 +202,42 @@ func _Octopus_CreateDataSet_Handler(srv interface{}, ctx context.Context, dec fu
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetMyAlgorithmList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMyAlgorithmListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetMyAlgorithmList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetMyAlgorithmList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetMyAlgorithmList(ctx, req.(*GetMyAlgorithmListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetNotebookList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetNotebookListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetNotebookList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetNotebookList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetNotebookList(ctx, req.(*GetNotebookListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetUserImageList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserImageListReq)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -205,6 +275,14 @@ var Octopus_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "CreateDataSet",
|
||||
Handler: _Octopus_CreateDataSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMyAlgorithmList",
|
||||
Handler: _Octopus_GetMyAlgorithmList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetNotebookList",
|
||||
Handler: _Octopus_GetNotebookList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserImageList",
|
||||
Handler: _Octopus_GetUserImageList_Handler,
|
||||
|
|
|
@ -13,22 +13,35 @@ import (
|
|||
)
|
||||
|
||||
type (
|
||||
Algorithms = octopus.Algorithms
|
||||
CpResp = octopus.CpResp
|
||||
CreateDataSetReq = octopus.CreateDataSetReq
|
||||
CreateDataSetResq = octopus.CreateDataSetResq
|
||||
Error = octopus.Error
|
||||
GetMyAlgorithmListReq = octopus.GetMyAlgorithmListReq
|
||||
GetMyAlgorithmListResp = octopus.GetMyAlgorithmListResp
|
||||
GetNotebookListReq = octopus.GetNotebookListReq
|
||||
GetNotebookListResp = octopus.GetNotebookListResp
|
||||
GetUserImageListReq = octopus.GetUserImageListReq
|
||||
GetUserImageListResp = octopus.GetUserImageListResp
|
||||
GiResp = octopus.GiResp
|
||||
Image = octopus.Image
|
||||
Images = octopus.Images
|
||||
Payload = octopus.Payload
|
||||
Notebooks = octopus.Notebooks
|
||||
PayloadMyAlgorithmList = octopus.PayloadMyAlgorithmList
|
||||
PayloadNotebookList = octopus.PayloadNotebookList
|
||||
PayloadUserImageList = octopus.PayloadUserImageList
|
||||
ResourceReq = octopus.ResourceReq
|
||||
Tasks = octopus.Tasks
|
||||
|
||||
Octopus interface {
|
||||
GetComputingPower(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*CpResp, error)
|
||||
GetGeneralInfo(ctx context.Context, in *ResourceReq, opts ...grpc.CallOption) (*GiResp, error)
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// Algorithm
|
||||
GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error)
|
||||
// ModelDeployService
|
||||
GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error)
|
||||
}
|
||||
|
@ -59,6 +72,18 @@ func (m *defaultOctopus) CreateDataSet(ctx context.Context, in *CreateDataSetReq
|
|||
return client.CreateDataSet(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// Algorithm
|
||||
func (m *defaultOctopus) GetMyAlgorithmList(ctx context.Context, in *GetMyAlgorithmListReq, opts ...grpc.CallOption) (*GetMyAlgorithmListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetMyAlgorithmList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (m *defaultOctopus) GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetNotebookList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ImageService
|
||||
func (m *defaultOctopus) GetUserImageList(ctx context.Context, in *GetUserImageListReq, opts ...grpc.CallOption) (*GetUserImageListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
|
|
|
@ -31,6 +31,43 @@ message CreateDataSetResq{
|
|||
}
|
||||
|
||||
/******************Algorithm Start*************************/
|
||||
message GetMyAlgorithmListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetMyAlgorithmListResp{
|
||||
bool success =1;
|
||||
PayloadMyAlgorithmList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadMyAlgorithmList{
|
||||
int32 totalSize =1;
|
||||
repeated Algorithms algorithms = 2;
|
||||
}
|
||||
|
||||
message Algorithms{
|
||||
string algorithmId =1;
|
||||
string algorithmVersion = 2;
|
||||
string spaceId = 3;
|
||||
string spaceName = 4;
|
||||
string userId = 5;
|
||||
string userName=6;
|
||||
string algorithmName=7;
|
||||
string modelName=8;
|
||||
int32 fileStatus=9;
|
||||
int32 latestCompressed=10;
|
||||
string algorithmDescript=11;
|
||||
string path=12;
|
||||
bool isPrefab=13;
|
||||
int64 createdAt=14;
|
||||
string applyId=15;
|
||||
string applyName=16;
|
||||
string frameworkId=17;
|
||||
string frameworkName=18;
|
||||
}
|
||||
/******************Algorithm End*************************/
|
||||
|
||||
/******************DatasetService Start*************************/
|
||||
|
@ -40,6 +77,53 @@ message CreateDataSetResq{
|
|||
/******************ModelDeployService End*************************/
|
||||
|
||||
/******************Develop Start*************************/
|
||||
message GetNotebookListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetNotebookListResp{
|
||||
bool success =1;
|
||||
PayloadNotebookList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadNotebookList{
|
||||
int32 totalSize =1;
|
||||
repeated Notebooks notebooks = 2;
|
||||
}
|
||||
|
||||
message Notebooks{
|
||||
int64 createdAt =1;
|
||||
int64 updatedAt =2;
|
||||
string id = 3;
|
||||
string userId =4;
|
||||
string workspaceId=5;
|
||||
string name=6;
|
||||
string desc=7;
|
||||
string imageId=8;
|
||||
string imageName=9;
|
||||
string algorithmId=10;
|
||||
string algorithmVersion=11;
|
||||
string algorithmName=12;
|
||||
string resourceSpecId=13;
|
||||
string resourceSpecName=14;
|
||||
string status=15;
|
||||
string datasetId=16;
|
||||
string datasetVersion=17;
|
||||
string datasetName=18;
|
||||
int32 resourceSpecPrice=19;
|
||||
string notebookJobId=20;
|
||||
string imageVersion=21;
|
||||
repeated Tasks tasks=22;
|
||||
string imageUrl=23;
|
||||
}
|
||||
|
||||
message Tasks{
|
||||
string url =1;
|
||||
string name= 2;
|
||||
}
|
||||
/******************Develop End*************************/
|
||||
|
||||
/******************ImageService Start*************************/
|
||||
|
@ -51,18 +135,11 @@ message GetUserImageListReq{
|
|||
|
||||
message GetUserImageListResp{
|
||||
bool success =1;
|
||||
Payload payload =2;
|
||||
PayloadUserImageList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message Error{
|
||||
int32 code =1;
|
||||
int32 subcode =2;
|
||||
string message =3;
|
||||
string subMessage =4;
|
||||
}
|
||||
|
||||
message Payload{
|
||||
message PayloadUserImageList{
|
||||
int32 totalSize =1;
|
||||
repeated Images images =2;
|
||||
}
|
||||
|
@ -96,6 +173,13 @@ message Image{
|
|||
/******************TrainJobService Start*************************/
|
||||
/******************TrainJobService End*************************/
|
||||
|
||||
message Error{
|
||||
int32 code =1;
|
||||
int32 subcode =2;
|
||||
string message =3;
|
||||
string subMessage =4;
|
||||
}
|
||||
|
||||
|
||||
service Octopus {
|
||||
|
||||
|
@ -106,11 +190,13 @@ service Octopus {
|
|||
rpc CreateDataSet(CreateDataSetReq) returns (CreateDataSetResq);
|
||||
|
||||
//Algorithm
|
||||
rpc GetMyAlgorithmList(GetMyAlgorithmListReq) returns (GetMyAlgorithmListResp);
|
||||
|
||||
//DatasetService
|
||||
|
||||
//ModelDeployService
|
||||
//Develop
|
||||
rpc GetNotebookList(GetNotebookListReq) returns (GetNotebookListResp);
|
||||
|
||||
//ImageService
|
||||
rpc GetUserImageList(GetUserImageListReq) returns (GetUserImageListResp);
|
||||
|
|
Loading…
Reference in New Issue