forked from JointCloud/pcm-coordinator
added createinferencetask
This commit is contained in:
parent
7acfb8df7b
commit
112b3409c1
|
@ -1,5 +1,9 @@
|
|||
syntax = "v1"
|
||||
|
||||
import (
|
||||
"../schedule/pcm-schedule.api"
|
||||
)
|
||||
|
||||
type (
|
||||
/******************image inference*************************/
|
||||
DeployInstance {
|
||||
|
@ -231,5 +235,17 @@ type (
|
|||
ClusterName string `json:"clusterName"`
|
||||
}
|
||||
|
||||
// 推理任务
|
||||
CreateInferenceTaskReq {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,optional"`
|
||||
Token string `json:"token,optional"`
|
||||
UserIp string `json:"userIp,optional"`
|
||||
JobResources JobResources `json:"jobResources"`
|
||||
DataDistributes DataDistribute `json:"dataDistributes"`
|
||||
}
|
||||
|
||||
CreateInferenceTaskResp {
|
||||
|
||||
}
|
||||
)
|
||||
|
|
|
@ -960,6 +960,9 @@ service pcm {
|
|||
group: inference
|
||||
)
|
||||
service pcm {
|
||||
@handler CreateInferenceTaskHandler
|
||||
post /inference/createTask (CreateInferenceTaskReq) returns (CreateInferenceTaskResp)
|
||||
|
||||
@handler TextToTextInferenceHandler
|
||||
post /inference/text (TextToTextInferenceReq) returns (TextToTextInferenceResp)
|
||||
|
||||
|
|
|
@ -189,10 +189,10 @@ type (
|
|||
}
|
||||
|
||||
DataDistribute {
|
||||
Dataset []*DatasetDistribute `json:"dataset"`
|
||||
Dataset []*DatasetDistribute `json:"dataset,optional"`
|
||||
Code []*CodeDistribute `json:"code"`
|
||||
Image []*ImageDistribute `json:"image"`
|
||||
Model []*ModelDistribute `json:"model"`
|
||||
Model []*ModelDistribute `json:"model,optional"`
|
||||
}
|
||||
|
||||
DatasetDistribute {
|
||||
|
|
|
@ -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 CreateInferenceTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateInferenceTaskReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := inference.NewCreateInferenceTaskLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateInferenceTask(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1208,6 +1208,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/inference/createTask",
|
||||
Handler: inference.CreateInferenceTaskHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/inference/text",
|
||||
|
|
|
@ -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 CreateInferenceTaskLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateInferenceTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateInferenceTaskLogic {
|
||||
return &CreateInferenceTaskLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateInferenceTaskLogic) CreateInferenceTask(req *types.CreateInferenceTaskReq) (resp *types.CreateInferenceTaskResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
|
@ -1308,7 +1308,7 @@ type ResourceCostRecord struct {
|
|||
|
||||
type CommitHpcTaskReq struct {
|
||||
Name string `json:"name"`
|
||||
Backend string `json:"backend"` //
|
||||
Backend string `json:"backend"`
|
||||
ClusterId string `json:"clusterId"`
|
||||
App string `json:"app"`
|
||||
Description string `json:"description,optional"`
|
||||
|
@ -1447,7 +1447,6 @@ type HpcInstanceCenterReq struct {
|
|||
InstanceType int32 `form:"instanceType,optional"`
|
||||
InstanceClass string `form:"instanceClass,optional"`
|
||||
InstanceName string `form:"instanceName,optional"`
|
||||
PageInfo
|
||||
}
|
||||
|
||||
type HpcInstanceCenterResp struct {
|
||||
|
@ -5952,10 +5951,10 @@ type JobRuntimeInfo struct {
|
|||
}
|
||||
|
||||
type DataDistribute struct {
|
||||
Dataset []*DatasetDistribute `json:"dataset"`
|
||||
Dataset []*DatasetDistribute `json:"dataset,optional"`
|
||||
Code []*CodeDistribute `json:"code"`
|
||||
Image []*ImageDistribute `json:"image"`
|
||||
Model []*ModelDistribute `json:"model"`
|
||||
Model []*ModelDistribute `json:"model,optional"`
|
||||
}
|
||||
|
||||
type DatasetDistribute struct {
|
||||
|
@ -6355,3 +6354,15 @@ type ClusterAvail struct {
|
|||
ClusterId string `json:"clusterId"`
|
||||
ClusterName string `json:"clusterName"`
|
||||
}
|
||||
|
||||
type CreateInferenceTaskReq struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,optional"`
|
||||
Token string `json:"token,optional"`
|
||||
UserIp string `json:"userIp,optional"`
|
||||
JobResources JobResources `json:"jobResources"`
|
||||
DataDistributes DataDistribute `json:"dataDistributes"`
|
||||
}
|
||||
|
||||
type CreateInferenceTaskResp struct {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue