启智章鱼trainjob相关接口

Former-commit-id: 5a7abd623643c5c4f6820f11da99f915243c7531
This commit is contained in:
tzwang 2023-05-27 11:28:51 +08:00
parent db1769c4ea
commit 723a949326
11 changed files with 2536 additions and 600 deletions

View File

@ -52,4 +52,9 @@ type OctopusApi struct {
DeleteMyModel string DeleteMyModel string
DeleteModelVersion string DeleteModelVersion string
DownloadModelVersion string DownloadModelVersion string
GetTrainJob string
DeleteTrainJob string
StopTrainJob string
GetTrainJobEvent string
GetTrainJobMetric string
} }

View File

@ -0,0 +1,52 @@
package logic
import (
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
"PCM/common/tool"
"context"
"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 DeleteTrainJobLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewDeleteTrainJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTrainJobLogic {
return &DeleteTrainJobLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *DeleteTrainJobLogic) DeleteTrainJob(in *octopus.DeleteTrainJobReq) (*octopus.DeleteTrainJobResp, error) {
resp := &octopus.DeleteTrainJobResp{}
var url_prefix = common.OctopusUrls[in.Platform]
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.DeleteTrainJob
token := common.GetToken(in.Platform)
req := tool.GetACHttpRequest()
var queryStr string
for _, s := range in.GetJobIds() {
queryStr += "jobIds=" + s + "&"
}
_, err := req.
SetHeader("Authorization", "Bearer "+token).
SetQueryString(queryStr).
SetResult(resp).
Delete(reqUrl)
if err != nil {
return nil, err
}
return resp, nil
}

View File

@ -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 GetTrainJobEventLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetTrainJobEventLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTrainJobEventLogic {
return &GetTrainJobEventLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetTrainJobEventLogic) GetTrainJobEvent(in *octopus.GetTrainJobEventReq) (*octopus.GetTrainJobEventResp, error) {
resp := &octopus.GetTrainJobEventResp{}
var url_prefix = common.OctopusUrls[in.Platform]
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJobEvent
token := common.GetToken(in.Platform)
req := tool.GetACHttpRequest()
_, err := req.
SetHeader("Authorization", "Bearer "+token).
SetQueryString("id=" + in.Id).
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
}

View File

@ -0,0 +1,47 @@
package logic
import (
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/octopus"
"PCM/common/tool"
"context"
"github.com/zeromicro/go-zero/core/logx"
)
type GetTrainJobLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetTrainJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTrainJobLogic {
return &GetTrainJobLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetTrainJobLogic) GetTrainJob(in *octopus.GetTrainJobReq) (*octopus.GetTrainJobResp, error) {
resp := &octopus.GetTrainJobResp{}
var url_prefix = common.OctopusUrls[in.Platform]
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJob
token := common.GetToken(in.Platform)
req := tool.GetACHttpRequest()
_, err := req.
SetHeader("Authorization", "Bearer "+token).
SetPathParam("id", in.Id).
SetResult(resp).
Get(reqUrl)
if err != nil {
return nil, err
}
return resp, nil
}

View File

@ -0,0 +1,52 @@
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 GetTrainJobMetricLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetTrainJobMetricLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTrainJobMetricLogic {
return &GetTrainJobMetricLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GetTrainJobMetricLogic) GetTrainJobMetric(in *octopus.GetTrainJobMetricReq) (*octopus.GetTrainJobMetricResp, error) {
resp := &octopus.GetTrainJobMetricResp{}
var url_prefix = common.OctopusUrls[in.Platform]
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.GetTrainJobMetric
token := common.GetToken(in.Platform)
req := tool.GetACHttpRequest()
_, err := req.
SetHeader("Authorization", "Bearer "+token).
SetQueryString("id=" + in.Id).
SetQueryString("start=" + strconv.Itoa(int(in.Start))).
SetQueryString("size=" + strconv.Itoa(int(in.Size))).
SetQueryString("step=" + strconv.Itoa(int(in.Step))).
SetResult(resp).
Get(reqUrl)
if err != nil {
return nil, err
}
return resp, nil
}

View File

@ -0,0 +1,49 @@
package logic
import (
"PCM/adaptor/PCM-AI/PCM-OCTOPUS/rpc/internal/common"
"PCM/common/tool"
"context"
"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 StopTrainJobLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewStopTrainJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StopTrainJobLogic {
return &StopTrainJobLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *StopTrainJobLogic) StopTrainJob(in *octopus.StopTrainJobReq) (*octopus.StopTrainJobResp, error) {
resp := &octopus.StopTrainJobResp{}
var url_prefix = common.OctopusUrls[in.Platform]
var reqUrl = url_prefix + l.svcCtx.Config.OctopusApi.StopTrainJob
token := common.GetToken(in.Platform)
req := tool.GetACHttpRequest()
_, err := req.
SetHeader("Authorization", "Bearer "+token).
SetPathParam("id", in.Id).
SetBody("{}").
SetResult(resp).
Post(reqUrl)
if err != nil {
return nil, err
}
return resp, nil
}

View File

@ -227,3 +227,28 @@ func (s *OctopusServer) GetTrainJobList(ctx context.Context, in *octopus.GetTrai
l := logic.NewGetTrainJobListLogic(ctx, s.svcCtx) l := logic.NewGetTrainJobListLogic(ctx, s.svcCtx)
return l.GetTrainJobList(in) return l.GetTrainJobList(in)
} }
func (s *OctopusServer) GetTrainJob(ctx context.Context, in *octopus.GetTrainJobReq) (*octopus.GetTrainJobResp, error) {
l := logic.NewGetTrainJobLogic(ctx, s.svcCtx)
return l.GetTrainJob(in)
}
func (s *OctopusServer) DeleteTrainJob(ctx context.Context, in *octopus.DeleteTrainJobReq) (*octopus.DeleteTrainJobResp, error) {
l := logic.NewDeleteTrainJobLogic(ctx, s.svcCtx)
return l.DeleteTrainJob(in)
}
func (s *OctopusServer) StopTrainJob(ctx context.Context, in *octopus.StopTrainJobReq) (*octopus.StopTrainJobResp, error) {
l := logic.NewStopTrainJobLogic(ctx, s.svcCtx)
return l.StopTrainJob(in)
}
func (s *OctopusServer) GetTrainJobEvent(ctx context.Context, in *octopus.GetTrainJobEventReq) (*octopus.GetTrainJobEventResp, error) {
l := logic.NewGetTrainJobEventLogic(ctx, s.svcCtx)
return l.GetTrainJobEvent(in)
}
func (s *OctopusServer) GetTrainJobMetric(ctx context.Context, in *octopus.GetTrainJobMetricReq) (*octopus.GetTrainJobMetricResp, error) {
l := logic.NewGetTrainJobMetricLogic(ctx, s.svcCtx)
return l.GetTrainJobMetric(in)
}

File diff suppressed because it is too large Load Diff

View File

@ -68,6 +68,11 @@ type OctopusClient interface {
// TrainJobService // TrainJobService
CreateTrainJob(ctx context.Context, in *CreateTrainJobReq, opts ...grpc.CallOption) (*CreateTrainJobResp, error) CreateTrainJob(ctx context.Context, in *CreateTrainJobReq, opts ...grpc.CallOption) (*CreateTrainJobResp, error)
GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error) GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error)
GetTrainJob(ctx context.Context, in *GetTrainJobReq, opts ...grpc.CallOption) (*GetTrainJobResp, error)
DeleteTrainJob(ctx context.Context, in *DeleteTrainJobReq, opts ...grpc.CallOption) (*DeleteTrainJobResp, error)
StopTrainJob(ctx context.Context, in *StopTrainJobReq, opts ...grpc.CallOption) (*StopTrainJobResp, error)
GetTrainJobEvent(ctx context.Context, in *GetTrainJobEventReq, opts ...grpc.CallOption) (*GetTrainJobEventResp, error)
GetTrainJobMetric(ctx context.Context, in *GetTrainJobMetricReq, opts ...grpc.CallOption) (*GetTrainJobMetricResp, error)
} }
type octopusClient struct { type octopusClient struct {
@ -438,6 +443,51 @@ func (c *octopusClient) GetTrainJobList(ctx context.Context, in *GetTrainJobList
return out, nil return out, nil
} }
func (c *octopusClient) GetTrainJob(ctx context.Context, in *GetTrainJobReq, opts ...grpc.CallOption) (*GetTrainJobResp, error) {
out := new(GetTrainJobResp)
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetTrainJob", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *octopusClient) DeleteTrainJob(ctx context.Context, in *DeleteTrainJobReq, opts ...grpc.CallOption) (*DeleteTrainJobResp, error) {
out := new(DeleteTrainJobResp)
err := c.cc.Invoke(ctx, "/octopus.Octopus/DeleteTrainJob", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *octopusClient) StopTrainJob(ctx context.Context, in *StopTrainJobReq, opts ...grpc.CallOption) (*StopTrainJobResp, error) {
out := new(StopTrainJobResp)
err := c.cc.Invoke(ctx, "/octopus.Octopus/StopTrainJob", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *octopusClient) GetTrainJobEvent(ctx context.Context, in *GetTrainJobEventReq, opts ...grpc.CallOption) (*GetTrainJobEventResp, error) {
out := new(GetTrainJobEventResp)
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetTrainJobEvent", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *octopusClient) GetTrainJobMetric(ctx context.Context, in *GetTrainJobMetricReq, opts ...grpc.CallOption) (*GetTrainJobMetricResp, error) {
out := new(GetTrainJobMetricResp)
err := c.cc.Invoke(ctx, "/octopus.Octopus/GetTrainJobMetric", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// OctopusServer is the server API for Octopus service. // OctopusServer is the server API for Octopus service.
// All implementations must embed UnimplementedOctopusServer // All implementations must embed UnimplementedOctopusServer
// for forward compatibility // for forward compatibility
@ -488,6 +538,11 @@ type OctopusServer interface {
// TrainJobService // TrainJobService
CreateTrainJob(context.Context, *CreateTrainJobReq) (*CreateTrainJobResp, error) CreateTrainJob(context.Context, *CreateTrainJobReq) (*CreateTrainJobResp, error)
GetTrainJobList(context.Context, *GetTrainJobListReq) (*GetTrainJobListResp, error) GetTrainJobList(context.Context, *GetTrainJobListReq) (*GetTrainJobListResp, error)
GetTrainJob(context.Context, *GetTrainJobReq) (*GetTrainJobResp, error)
DeleteTrainJob(context.Context, *DeleteTrainJobReq) (*DeleteTrainJobResp, error)
StopTrainJob(context.Context, *StopTrainJobReq) (*StopTrainJobResp, error)
GetTrainJobEvent(context.Context, *GetTrainJobEventReq) (*GetTrainJobEventResp, error)
GetTrainJobMetric(context.Context, *GetTrainJobMetricReq) (*GetTrainJobMetricResp, error)
mustEmbedUnimplementedOctopusServer() mustEmbedUnimplementedOctopusServer()
} }
@ -615,6 +670,21 @@ func (UnimplementedOctopusServer) CreateTrainJob(context.Context, *CreateTrainJo
func (UnimplementedOctopusServer) GetTrainJobList(context.Context, *GetTrainJobListReq) (*GetTrainJobListResp, error) { func (UnimplementedOctopusServer) GetTrainJobList(context.Context, *GetTrainJobListReq) (*GetTrainJobListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTrainJobList not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetTrainJobList not implemented")
} }
func (UnimplementedOctopusServer) GetTrainJob(context.Context, *GetTrainJobReq) (*GetTrainJobResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTrainJob not implemented")
}
func (UnimplementedOctopusServer) DeleteTrainJob(context.Context, *DeleteTrainJobReq) (*DeleteTrainJobResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteTrainJob not implemented")
}
func (UnimplementedOctopusServer) StopTrainJob(context.Context, *StopTrainJobReq) (*StopTrainJobResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method StopTrainJob not implemented")
}
func (UnimplementedOctopusServer) GetTrainJobEvent(context.Context, *GetTrainJobEventReq) (*GetTrainJobEventResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTrainJobEvent not implemented")
}
func (UnimplementedOctopusServer) GetTrainJobMetric(context.Context, *GetTrainJobMetricReq) (*GetTrainJobMetricResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTrainJobMetric not implemented")
}
func (UnimplementedOctopusServer) mustEmbedUnimplementedOctopusServer() {} func (UnimplementedOctopusServer) mustEmbedUnimplementedOctopusServer() {}
// UnsafeOctopusServer may be embedded to opt out of forward compatibility for this service. // UnsafeOctopusServer may be embedded to opt out of forward compatibility for this service.
@ -1348,6 +1418,96 @@ func _Octopus_GetTrainJobList_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Octopus_GetTrainJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTrainJobReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OctopusServer).GetTrainJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/octopus.Octopus/GetTrainJob",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OctopusServer).GetTrainJob(ctx, req.(*GetTrainJobReq))
}
return interceptor(ctx, in, info, handler)
}
func _Octopus_DeleteTrainJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteTrainJobReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OctopusServer).DeleteTrainJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/octopus.Octopus/DeleteTrainJob",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OctopusServer).DeleteTrainJob(ctx, req.(*DeleteTrainJobReq))
}
return interceptor(ctx, in, info, handler)
}
func _Octopus_StopTrainJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StopTrainJobReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OctopusServer).StopTrainJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/octopus.Octopus/StopTrainJob",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OctopusServer).StopTrainJob(ctx, req.(*StopTrainJobReq))
}
return interceptor(ctx, in, info, handler)
}
func _Octopus_GetTrainJobEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTrainJobEventReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OctopusServer).GetTrainJobEvent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/octopus.Octopus/GetTrainJobEvent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OctopusServer).GetTrainJobEvent(ctx, req.(*GetTrainJobEventReq))
}
return interceptor(ctx, in, info, handler)
}
func _Octopus_GetTrainJobMetric_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTrainJobMetricReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OctopusServer).GetTrainJobMetric(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/octopus.Octopus/GetTrainJobMetric",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OctopusServer).GetTrainJobMetric(ctx, req.(*GetTrainJobMetricReq))
}
return interceptor(ctx, in, info, handler)
}
// Octopus_ServiceDesc is the grpc.ServiceDesc for Octopus service. // Octopus_ServiceDesc is the grpc.ServiceDesc for Octopus service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -1515,6 +1675,26 @@ var Octopus_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetTrainJobList", MethodName: "GetTrainJobList",
Handler: _Octopus_GetTrainJobList_Handler, Handler: _Octopus_GetTrainJobList_Handler,
}, },
{
MethodName: "GetTrainJob",
Handler: _Octopus_GetTrainJob_Handler,
},
{
MethodName: "DeleteTrainJob",
Handler: _Octopus_DeleteTrainJob_Handler,
},
{
MethodName: "StopTrainJob",
Handler: _Octopus_StopTrainJob_Handler,
},
{
MethodName: "GetTrainJobEvent",
Handler: _Octopus_GetTrainJobEvent_Handler,
},
{
MethodName: "GetTrainJobMetric",
Handler: _Octopus_GetTrainJobMetric_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "octopus.proto", Metadata: "octopus.proto",

View File

@ -52,6 +52,8 @@ type (
DeleteMyModelResp = octopus.DeleteMyModelResp DeleteMyModelResp = octopus.DeleteMyModelResp
DeleteNotebookReq = octopus.DeleteNotebookReq DeleteNotebookReq = octopus.DeleteNotebookReq
DeleteNotebookResp = octopus.DeleteNotebookResp DeleteNotebookResp = octopus.DeleteNotebookResp
DeleteTrainJobReq = octopus.DeleteTrainJobReq
DeleteTrainJobResp = octopus.DeleteTrainJobResp
DownloadAlgorithmReq = octopus.DownloadAlgorithmReq DownloadAlgorithmReq = octopus.DownloadAlgorithmReq
DownloadAlgorithmResp = octopus.DownloadAlgorithmResp DownloadAlgorithmResp = octopus.DownloadAlgorithmResp
DownloadModelVersionReq = octopus.DownloadModelVersionReq DownloadModelVersionReq = octopus.DownloadModelVersionReq
@ -84,14 +86,21 @@ type (
GetNotebookListResp = octopus.GetNotebookListResp GetNotebookListResp = octopus.GetNotebookListResp
GetNotebookReq = octopus.GetNotebookReq GetNotebookReq = octopus.GetNotebookReq
GetNotebookResp = octopus.GetNotebookResp GetNotebookResp = octopus.GetNotebookResp
GetTrainJobEventReq = octopus.GetTrainJobEventReq
GetTrainJobEventResp = octopus.GetTrainJobEventResp
GetTrainJobListReq = octopus.GetTrainJobListReq GetTrainJobListReq = octopus.GetTrainJobListReq
GetTrainJobListResp = octopus.GetTrainJobListResp GetTrainJobListResp = octopus.GetTrainJobListResp
GetTrainJobMetricReq = octopus.GetTrainJobMetricReq
GetTrainJobMetricResp = octopus.GetTrainJobMetricResp
GetTrainJobReq = octopus.GetTrainJobReq
GetTrainJobResp = octopus.GetTrainJobResp
GetUserImageListReq = octopus.GetUserImageListReq GetUserImageListReq = octopus.GetUserImageListReq
GetUserImageListResp = octopus.GetUserImageListResp GetUserImageListResp = octopus.GetUserImageListResp
GiResp = octopus.GiResp GiResp = octopus.GiResp
Headers = octopus.Headers Headers = octopus.Headers
Image = octopus.Image Image = octopus.Image
Images = octopus.Images Images = octopus.Images
JobEvent = octopus.JobEvent
Lables = octopus.Lables Lables = octopus.Lables
Model = octopus.Model Model = octopus.Model
ModelVersion = octopus.ModelVersion ModelVersion = octopus.ModelVersion
@ -114,6 +123,7 @@ type (
PayloadDeleteMyAlgorithm = octopus.PayloadDeleteMyAlgorithm PayloadDeleteMyAlgorithm = octopus.PayloadDeleteMyAlgorithm
PayloadDeleteMyModel = octopus.PayloadDeleteMyModel PayloadDeleteMyModel = octopus.PayloadDeleteMyModel
PayloadDeleteNotebook = octopus.PayloadDeleteNotebook PayloadDeleteNotebook = octopus.PayloadDeleteNotebook
PayloadDeleteTrainJob = octopus.PayloadDeleteTrainJob
PayloadDownloadAlgorithm = octopus.PayloadDownloadAlgorithm PayloadDownloadAlgorithm = octopus.PayloadDownloadAlgorithm
PayloadDownloadModelVersion = octopus.PayloadDownloadModelVersion PayloadDownloadModelVersion = octopus.PayloadDownloadModelVersion
PayloadGetAlgorithm = octopus.PayloadGetAlgorithm PayloadGetAlgorithm = octopus.PayloadGetAlgorithm
@ -124,12 +134,16 @@ type (
PayloadGetModelVersionList = octopus.PayloadGetModelVersionList PayloadGetModelVersionList = octopus.PayloadGetModelVersionList
PayloadGetMyModelList = octopus.PayloadGetMyModelList PayloadGetMyModelList = octopus.PayloadGetMyModelList
PayloadGetNotebook = octopus.PayloadGetNotebook PayloadGetNotebook = octopus.PayloadGetNotebook
PayloadGetTrainJob = octopus.PayloadGetTrainJob
PayloadGetTrainJobEvent = octopus.PayloadGetTrainJobEvent
PayloadGetTrainJobList = octopus.PayloadGetTrainJobList PayloadGetTrainJobList = octopus.PayloadGetTrainJobList
PayloadGetTrainJobMetric = octopus.PayloadGetTrainJobMetric
PayloadMyAlgorithmList = octopus.PayloadMyAlgorithmList PayloadMyAlgorithmList = octopus.PayloadMyAlgorithmList
PayloadMyDatasetList = octopus.PayloadMyDatasetList PayloadMyDatasetList = octopus.PayloadMyDatasetList
PayloadNotebookList = octopus.PayloadNotebookList PayloadNotebookList = octopus.PayloadNotebookList
PayloadStartNotebook = octopus.PayloadStartNotebook PayloadStartNotebook = octopus.PayloadStartNotebook
PayloadStopNotebook = octopus.PayloadStopNotebook PayloadStopNotebook = octopus.PayloadStopNotebook
PayloadStopTrainJob = octopus.PayloadStopTrainJob
PayloadUploadAlgorithm = octopus.PayloadUploadAlgorithm PayloadUploadAlgorithm = octopus.PayloadUploadAlgorithm
PayloadUploadAlgorithmConfirm = octopus.PayloadUploadAlgorithmConfirm PayloadUploadAlgorithmConfirm = octopus.PayloadUploadAlgorithmConfirm
PayloadUploadDataSet = octopus.PayloadUploadDataSet PayloadUploadDataSet = octopus.PayloadUploadDataSet
@ -143,6 +157,8 @@ type (
StartNotebookResp = octopus.StartNotebookResp StartNotebookResp = octopus.StartNotebookResp
StopNotebookReq = octopus.StopNotebookReq StopNotebookReq = octopus.StopNotebookReq
StopNotebookResp = octopus.StopNotebookResp StopNotebookResp = octopus.StopNotebookResp
StopTrainJobReq = octopus.StopTrainJobReq
StopTrainJobResp = octopus.StopTrainJobResp
Tasks = octopus.Tasks Tasks = octopus.Tasks
TrainJob = octopus.TrainJob TrainJob = octopus.TrainJob
TrainJobOctopus = octopus.TrainJobOctopus TrainJobOctopus = octopus.TrainJobOctopus
@ -213,6 +229,11 @@ type (
// TrainJobService // TrainJobService
CreateTrainJob(ctx context.Context, in *CreateTrainJobReq, opts ...grpc.CallOption) (*CreateTrainJobResp, error) CreateTrainJob(ctx context.Context, in *CreateTrainJobReq, opts ...grpc.CallOption) (*CreateTrainJobResp, error)
GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error) GetTrainJobList(ctx context.Context, in *GetTrainJobListReq, opts ...grpc.CallOption) (*GetTrainJobListResp, error)
GetTrainJob(ctx context.Context, in *GetTrainJobReq, opts ...grpc.CallOption) (*GetTrainJobResp, error)
DeleteTrainJob(ctx context.Context, in *DeleteTrainJobReq, opts ...grpc.CallOption) (*DeleteTrainJobResp, error)
StopTrainJob(ctx context.Context, in *StopTrainJobReq, opts ...grpc.CallOption) (*StopTrainJobResp, error)
GetTrainJobEvent(ctx context.Context, in *GetTrainJobEventReq, opts ...grpc.CallOption) (*GetTrainJobEventResp, error)
GetTrainJobMetric(ctx context.Context, in *GetTrainJobMetricReq, opts ...grpc.CallOption) (*GetTrainJobMetricResp, error)
} }
defaultOctopus struct { defaultOctopus struct {
@ -431,3 +452,28 @@ func (m *defaultOctopus) GetTrainJobList(ctx context.Context, in *GetTrainJobLis
client := octopus.NewOctopusClient(m.cli.Conn()) client := octopus.NewOctopusClient(m.cli.Conn())
return client.GetTrainJobList(ctx, in, opts...) return client.GetTrainJobList(ctx, in, opts...)
} }
func (m *defaultOctopus) GetTrainJob(ctx context.Context, in *GetTrainJobReq, opts ...grpc.CallOption) (*GetTrainJobResp, error) {
client := octopus.NewOctopusClient(m.cli.Conn())
return client.GetTrainJob(ctx, in, opts...)
}
func (m *defaultOctopus) DeleteTrainJob(ctx context.Context, in *DeleteTrainJobReq, opts ...grpc.CallOption) (*DeleteTrainJobResp, error) {
client := octopus.NewOctopusClient(m.cli.Conn())
return client.DeleteTrainJob(ctx, in, opts...)
}
func (m *defaultOctopus) StopTrainJob(ctx context.Context, in *StopTrainJobReq, opts ...grpc.CallOption) (*StopTrainJobResp, error) {
client := octopus.NewOctopusClient(m.cli.Conn())
return client.StopTrainJob(ctx, in, opts...)
}
func (m *defaultOctopus) GetTrainJobEvent(ctx context.Context, in *GetTrainJobEventReq, opts ...grpc.CallOption) (*GetTrainJobEventResp, error) {
client := octopus.NewOctopusClient(m.cli.Conn())
return client.GetTrainJobEvent(ctx, in, opts...)
}
func (m *defaultOctopus) GetTrainJobMetric(ctx context.Context, in *GetTrainJobMetricReq, opts ...grpc.CallOption) (*GetTrainJobMetricResp, error) {
client := octopus.NewOctopusClient(m.cli.Conn())
return client.GetTrainJobMetric(ctx, in, opts...)
}

View File

@ -848,6 +848,97 @@ message Model{
/******************Model End*************************/ /******************Model End*************************/
/******************TrainJobService Start*************************/ /******************TrainJobService Start*************************/
message GetTrainJobReq{
string platform =1;
string id =2;
}
message GetTrainJobResp{
bool success =1;
PayloadGetTrainJob payload =2;
Error error = 3;
}
message PayloadGetTrainJob{
TrainJob trainJob = 1;
}
message DeleteTrainJobReq{
string platform =1;
repeated string jobIds = 2;
}
message DeleteTrainJobResp{
bool success =1;
PayloadDeleteTrainJob payload =2;
Error error = 3;
}
message PayloadDeleteTrainJob{
int64 deletedAt = 1;
}
message StopTrainJobReq{
string platform =1;
string id =2;
}
message StopTrainJobResp{
bool success =1;
PayloadStopTrainJob payload =2;
Error error = 3;
}
message PayloadStopTrainJob{
int64 stoppedAt = 1;
}
message GetTrainJobEventReq{
string platform =1;
string id =2;
int32 pageIndex =3;
int32 pageSize =4;
}
message GetTrainJobEventResp{
bool success =1;
PayloadGetTrainJobEvent payload =2;
Error error = 3;
}
message PayloadGetTrainJobEvent{
int32 totalSize = 1;
repeated JobEvent jobEvents = 2;
}
message JobEvent{
string message = 1;
string name = 2;
string reason = 3;
string timestamp = 4;
}
message GetTrainJobMetricReq{
string platform =1;
string id =2;
int64 start = 3;
int32 size = 4;
int32 step = 5;
}
message GetTrainJobMetricResp{
bool success =1;
PayloadGetTrainJobMetric payload =2;
Error error = 3;
}
message PayloadGetTrainJobMetric{
repeated int64 cpuUsage = 1;
repeated int64 gpuMemUsage = 2;
repeated int64 gpuUtil = 3;
repeated int64 memUsage = 4;
}
message GetTrainJobListReq{ message GetTrainJobListReq{
string platform =1; string platform =1;
int32 pageIndex =2; int32 pageIndex =2;
@ -1046,5 +1137,14 @@ service Octopus {
//TrainJobService //TrainJobService
rpc CreateTrainJob(CreateTrainJobReq) returns (CreateTrainJobResp); rpc CreateTrainJob(CreateTrainJobReq) returns (CreateTrainJobResp);
rpc GetTrainJobList(GetTrainJobListReq) returns (GetTrainJobListResp); rpc GetTrainJobList(GetTrainJobListReq) returns (GetTrainJobListResp);
rpc GetTrainJob(GetTrainJobReq) returns (GetTrainJobResp);
rpc DeleteTrainJob(DeleteTrainJobReq) returns (DeleteTrainJobResp);
rpc StopTrainJob(StopTrainJobReq) returns (StopTrainJobResp);
rpc GetTrainJobEvent(GetTrainJobEventReq) returns (GetTrainJobEventResp);
rpc GetTrainJobMetric(GetTrainJobMetricReq) returns (GetTrainJobMetricResp);
} }