added startall logics
Former-commit-id: 28d49b1a13320918330cfa02c8869043e7c5e73e
This commit is contained in:
parent
4bd778ba3a
commit
7af11688ef
|
@ -122,7 +122,7 @@ type (
|
||||||
}
|
}
|
||||||
|
|
||||||
StartAllByDeployTaskIdReq {
|
StartAllByDeployTaskIdReq {
|
||||||
Id string `form:"id"`
|
Id string `form:"deployTaskid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
StartAllByDeployTaskIdResp {
|
StartAllByDeployTaskIdResp {
|
||||||
|
@ -130,7 +130,7 @@ type (
|
||||||
}
|
}
|
||||||
|
|
||||||
StopAllByDeployTaskIdReq {
|
StopAllByDeployTaskIdReq {
|
||||||
Id string `form:"id"`
|
Id string `form:"deployTaskid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
StopAllByDeployTaskIdResp {
|
StopAllByDeployTaskIdResp {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package inference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetDeployTasksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.GetDeployTasksReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := inference.NewGetDeployTasksLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetDeployTasks(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package inference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func StartAllByDeployTaskIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.StartAllByDeployTaskIdReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := inference.NewStartAllByDeployTaskIdLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.StartAllByDeployTaskId(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package inference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/inference"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func StopAllByDeployTaskIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.StopAllByDeployTaskIdReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := inference.NewStopAllByDeployTaskIdLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.StopAllByDeployTaskId(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1213,6 +1213,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||||
Path: "/inference/taskStat",
|
Path: "/inference/taskStat",
|
||||||
Handler: inference.InferenceTaskStatHandler(serverCtx),
|
Handler: inference.InferenceTaskStatHandler(serverCtx),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/inference/startAll",
|
||||||
|
Handler: inference.StartAllByDeployTaskIdHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/inference/stopAll",
|
||||||
|
Handler: inference.StopAllByDeployTaskIdHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/inference/getDeployTasks",
|
||||||
|
Handler: inference.GetDeployTasksHandler(serverCtx),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
rest.WithPrefix("/pcm/v1"),
|
rest.WithPrefix("/pcm/v1"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package inference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetDeployTasksLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetDeployTasksLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeployTasksLogic {
|
||||||
|
return &GetDeployTasksLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetDeployTasksLogic) GetDeployTasks(req *types.GetDeployTasksReq) (resp *types.GetDeployTasksResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package inference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type StartAllByDeployTaskIdLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewStartAllByDeployTaskIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartAllByDeployTaskIdLogic {
|
||||||
|
return &StartAllByDeployTaskIdLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *StartAllByDeployTaskIdLogic) StartAllByDeployTaskId(req *types.StartAllByDeployTaskIdReq) (resp *types.StartAllByDeployTaskIdResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package inference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||||
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type StopAllByDeployTaskIdLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewStopAllByDeployTaskIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StopAllByDeployTaskIdLogic {
|
||||||
|
return &StopAllByDeployTaskIdLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *StopAllByDeployTaskIdLogic) StopAllByDeployTaskId(req *types.StopAllByDeployTaskIdReq) (resp *types.StopAllByDeployTaskIdResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
|
@ -6012,3 +6012,25 @@ type InferenceTaskStatResp struct {
|
||||||
Running int32 `json:"running"`
|
Running int32 `json:"running"`
|
||||||
Total int32 `json:"total"`
|
Total int32 `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StartAllByDeployTaskIdReq struct {
|
||||||
|
Id string `form:"deployTaskid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StartAllByDeployTaskIdResp struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type StopAllByDeployTaskIdReq struct {
|
||||||
|
Id string `form:"deployTaskid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StopAllByDeployTaskIdResp struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDeployTasksReq struct {
|
||||||
|
PageInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDeployTasksResp struct {
|
||||||
|
PageResult
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue