octopus 添加我的数据集列表接口
This commit is contained in:
parent
3cdbbf1239
commit
c7b1a9b0d4
|
@ -17,4 +17,5 @@ type OctopusApi struct {
|
|||
GetUserImageList string
|
||||
GetMyAlgorithmList string
|
||||
GetNotebookList string
|
||||
GetMydatasetList 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 GetMyDatasetListLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetMyDatasetListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyDatasetListLogic {
|
||||
return &GetMyDatasetListLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// DatasetService
|
||||
func (l *GetMyDatasetListLogic) GetMyDatasetList(in *octopus.GetMyDatasetListReq) (*octopus.GetMyDatasetListResp, error) {
|
||||
resp := &octopus.GetMyDatasetListResp{}
|
||||
|
||||
var url_prefix = common.OctopusUrls[in.Platform]
|
||||
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetMydatasetList
|
||||
|
||||
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
|
||||
}
|
|
@ -32,17 +32,23 @@ func (s *OctopusServer) GetGeneralInfo(ctx context.Context, in *octopus.Resource
|
|||
return l.GetGeneralInfo(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) CreateDataSet(ctx context.Context, in *octopus.CreateDataSetReq) (*octopus.CreateDataSetResq, error) {
|
||||
l := logic.NewCreateDataSetLogic(ctx, s.svcCtx)
|
||||
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)
|
||||
}
|
||||
|
||||
// DatasetService
|
||||
func (s *OctopusServer) GetMyDatasetList(ctx context.Context, in *octopus.GetMyDatasetListReq) (*octopus.GetMyDatasetListResp, error) {
|
||||
l := logic.NewGetMyDatasetListLogic(ctx, s.svcCtx)
|
||||
return l.GetMyDatasetList(in)
|
||||
}
|
||||
|
||||
func (s *OctopusServer) CreateDataSet(ctx context.Context, in *octopus.CreateDataSetReq) (*octopus.CreateDataSetResq, error) {
|
||||
l := logic.NewCreateDataSetLogic(ctx, s.svcCtx)
|
||||
return l.CreateDataSet(in)
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (s *OctopusServer) GetNotebookList(ctx context.Context, in *octopus.GetNotebookListReq) (*octopus.GetNotebookListResp, error) {
|
||||
l := logic.NewGetNotebookListLogic(ctx, s.svcCtx)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,9 +24,11 @@ const _ = grpc.SupportPackageIsVersion7
|
|||
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)
|
||||
// DatasetService
|
||||
GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error)
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// ModelDeployService
|
||||
// Develop
|
||||
GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error)
|
||||
|
@ -60,18 +62,27 @@ func (c *octopusClient) GetGeneralInfo(ctx context.Context, in *ResourceReq, opt
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
out := new(CreateDataSetResq)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/CreateDataSet", in, out, opts...)
|
||||
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) 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...)
|
||||
func (c *octopusClient) GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error) {
|
||||
out := new(GetMyDatasetListResp)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetMyDatasetList", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *octopusClient) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
out := new(CreateDataSetResq)
|
||||
err := c.cc.Invoke(ctx, "/octopus.Octopus/CreateDataSet", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -102,9 +113,11 @@ func (c *octopusClient) GetUserImageList(ctx context.Context, in *GetUserImageLi
|
|||
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)
|
||||
// DatasetService
|
||||
GetMyDatasetList(context.Context, *GetMyDatasetListReq) (*GetMyDatasetListResp, error)
|
||||
CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error)
|
||||
// ModelDeployService
|
||||
// Develop
|
||||
GetNotebookList(context.Context, *GetNotebookListReq) (*GetNotebookListResp, error)
|
||||
|
@ -123,12 +136,15 @@ func (UnimplementedOctopusServer) GetComputingPower(context.Context, *ResourceRe
|
|||
func (UnimplementedOctopusServer) GetGeneralInfo(context.Context, *ResourceReq) (*GiResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetGeneralInfo not implemented")
|
||||
}
|
||||
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) GetMyDatasetList(context.Context, *GetMyDatasetListReq) (*GetMyDatasetListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMyDatasetList not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) CreateDataSet(context.Context, *CreateDataSetReq) (*CreateDataSetResq, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateDataSet not implemented")
|
||||
}
|
||||
func (UnimplementedOctopusServer) GetNotebookList(context.Context, *GetNotebookListReq) (*GetNotebookListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetNotebookList not implemented")
|
||||
}
|
||||
|
@ -184,24 +200,6 @@ func _Octopus_GetGeneralInfo_Handler(srv interface{}, ctx context.Context, dec f
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_CreateDataSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateDataSetReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).CreateDataSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/CreateDataSet",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).CreateDataSet(ctx, req.(*CreateDataSetReq))
|
||||
}
|
||||
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 {
|
||||
|
@ -220,6 +218,42 @@ func _Octopus_GetMyAlgorithmList_Handler(srv interface{}, ctx context.Context, d
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_GetMyDatasetList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetMyDatasetListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).GetMyDatasetList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/GetMyDatasetList",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).GetMyDatasetList(ctx, req.(*GetMyDatasetListReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Octopus_CreateDataSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateDataSetReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OctopusServer).CreateDataSet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/octopus.Octopus/CreateDataSet",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OctopusServer).CreateDataSet(ctx, req.(*CreateDataSetReq))
|
||||
}
|
||||
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 {
|
||||
|
@ -271,14 +305,18 @@ var Octopus_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "GetGeneralInfo",
|
||||
Handler: _Octopus_GetGeneralInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateDataSet",
|
||||
Handler: _Octopus_CreateDataSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMyAlgorithmList",
|
||||
Handler: _Octopus_GetMyAlgorithmList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMyDatasetList",
|
||||
Handler: _Octopus_GetMyDatasetList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateDataSet",
|
||||
Handler: _Octopus_CreateDataSet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetNotebookList",
|
||||
Handler: _Octopus_GetNotebookList_Handler,
|
||||
|
|
|
@ -14,12 +14,16 @@ import (
|
|||
|
||||
type (
|
||||
Algorithms = octopus.Algorithms
|
||||
Applies = octopus.Applies
|
||||
CpResp = octopus.CpResp
|
||||
CreateDataSetReq = octopus.CreateDataSetReq
|
||||
CreateDataSetResq = octopus.CreateDataSetResq
|
||||
Datasets = octopus.Datasets
|
||||
Error = octopus.Error
|
||||
GetMyAlgorithmListReq = octopus.GetMyAlgorithmListReq
|
||||
GetMyAlgorithmListResp = octopus.GetMyAlgorithmListResp
|
||||
GetMyDatasetListReq = octopus.GetMyDatasetListReq
|
||||
GetMyDatasetListResp = octopus.GetMyDatasetListResp
|
||||
GetNotebookListReq = octopus.GetNotebookListReq
|
||||
GetNotebookListResp = octopus.GetNotebookListResp
|
||||
GetUserImageListReq = octopus.GetUserImageListReq
|
||||
|
@ -29,6 +33,7 @@ type (
|
|||
Images = octopus.Images
|
||||
Notebooks = octopus.Notebooks
|
||||
PayloadMyAlgorithmList = octopus.PayloadMyAlgorithmList
|
||||
PayloadMyDatasetList = octopus.PayloadMyDatasetList
|
||||
PayloadNotebookList = octopus.PayloadNotebookList
|
||||
PayloadUserImageList = octopus.PayloadUserImageList
|
||||
ResourceReq = octopus.ResourceReq
|
||||
|
@ -37,9 +42,11 @@ type (
|
|||
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)
|
||||
// DatasetService
|
||||
GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error)
|
||||
CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error)
|
||||
// ModelDeployService
|
||||
GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error)
|
||||
// ImageService
|
||||
|
@ -67,17 +74,23 @@ func (m *defaultOctopus) GetGeneralInfo(ctx context.Context, in *ResourceReq, op
|
|||
return client.GetGeneralInfo(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
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...)
|
||||
}
|
||||
|
||||
// DatasetService
|
||||
func (m *defaultOctopus) GetMyDatasetList(ctx context.Context, in *GetMyDatasetListReq, opts ...grpc.CallOption) (*GetMyDatasetListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.GetMyDatasetList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultOctopus) CreateDataSet(ctx context.Context, in *CreateDataSetReq, opts ...grpc.CallOption) (*CreateDataSetResq, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
return client.CreateDataSet(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ModelDeployService
|
||||
func (m *defaultOctopus) GetNotebookList(ctx context.Context, in *GetNotebookListReq, opts ...grpc.CallOption) (*GetNotebookListResp, error) {
|
||||
client := octopus.NewOctopusClient(m.cli.Conn())
|
||||
|
|
|
@ -71,6 +71,40 @@ message Algorithms{
|
|||
/******************Algorithm End*************************/
|
||||
|
||||
/******************DatasetService Start*************************/
|
||||
message GetMyDatasetListReq{
|
||||
string platform =1;
|
||||
int32 pageIndex =2;
|
||||
int32 pageSize =3;
|
||||
}
|
||||
|
||||
message GetMyDatasetListResp{
|
||||
bool success =1;
|
||||
PayloadMyDatasetList payload =2;
|
||||
Error error = 3;
|
||||
}
|
||||
|
||||
message PayloadMyDatasetList{
|
||||
int32 totalSize =1;
|
||||
repeated Datasets datasets = 2;
|
||||
}
|
||||
|
||||
message Datasets{
|
||||
int64 createdAt =1;
|
||||
int64 updatedAt=2;
|
||||
string id=3;
|
||||
int32 sourceType=4;
|
||||
string name=5;
|
||||
string typeId=6;
|
||||
string typeDesc=7;
|
||||
repeated Applies applies=8;
|
||||
string desc=9;
|
||||
string latestVersion=10;
|
||||
string userName = 11;
|
||||
}
|
||||
message Applies{
|
||||
string id=1;
|
||||
string desc=2;
|
||||
}
|
||||
/******************DatasetService End*************************/
|
||||
|
||||
/******************ModelDeployService Start*************************/
|
||||
|
@ -187,12 +221,14 @@ service Octopus {
|
|||
|
||||
rpc GetGeneralInfo(resourceReq) returns (giResp);
|
||||
|
||||
rpc CreateDataSet(CreateDataSetReq) returns (CreateDataSetResq);
|
||||
|
||||
//Algorithm
|
||||
rpc GetMyAlgorithmList(GetMyAlgorithmListReq) returns (GetMyAlgorithmListResp);
|
||||
|
||||
//DatasetService
|
||||
rpc GetMyDatasetList(GetMyDatasetListReq) returns (GetMyDatasetListResp);
|
||||
|
||||
rpc CreateDataSet(CreateDataSetReq) returns (CreateDataSetResq);
|
||||
|
||||
|
||||
//ModelDeployService
|
||||
//Develop
|
||||
|
|
Loading…
Reference in New Issue