Browse Source

updated getRunninginstances logic

Former-commit-id: 437d3a36b7
pull/287/head
tzwang 1 year ago
parent
commit
aaf7cf3cb5
3 changed files with 10 additions and 12 deletions
  1. +6
    -9
      internal/handler/inference/getrunninginstancebymodelhandler.go
  2. +3
    -3
      internal/logic/inference/getrunninginstancebymodellogic.go
  3. +1
    -0
      internal/storeLink/storeLink.go

+ 6
- 9
internal/handler/inference/getrunninginstancebymodelhandler.go View File

@@ -1,28 +1,25 @@
package inference package inference


import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http" "net/http"


"github.com/zeromicro/go-zero/rest/httpx" "github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/logic/inference"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/svc"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/types"
"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 GetRunningInstanceByModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { func GetRunningInstanceByModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRunningInstanceReq var req types.GetRunningInstanceReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
result.ParamErrorResult(r, w, err)
return return
} }


l := inference.NewGetRunningInstanceByModelLogic(r.Context(), svcCtx) l := inference.NewGetRunningInstanceByModelLogic(r.Context(), svcCtx)
resp, err := l.GetRunningInstanceByModel(&req) resp, err := l.GetRunningInstanceByModel(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
} }
} }

+ 3
- 3
internal/logic/inference/getrunninginstancebymodellogic.go View File

@@ -3,8 +3,8 @@ package inference
import ( import (
"context" "context"


"gitlink.org.cn/tzwang/pcm-coordinator/internal/svc"
"gitlink.org.cn/tzwang/pcm-coordinator/internal/types"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"


"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
) )
@@ -24,7 +24,7 @@ func NewGetRunningInstanceByModelLogic(ctx context.Context, svcCtx *svc.ServiceC
} }


func (l *GetRunningInstanceByModelLogic) GetRunningInstanceByModel(req *types.GetRunningInstanceReq) (resp *types.GetRunningInstanceResp, err error) { func (l *GetRunningInstanceByModelLogic) GetRunningInstanceByModel(req *types.GetRunningInstanceReq) (resp *types.GetRunningInstanceResp, err error) {
// todo: add your logic here and delete this line
resp = &types.GetRunningInstanceResp{}


return return
} }

+ 1
- 0
internal/storeLink/storeLink.go View File

@@ -82,6 +82,7 @@ var (
"image_classification": {"imagenet_resnet50"}, "image_classification": {"imagenet_resnet50"},
"text_to_text": {"chatGLM_6B"}, "text_to_text": {"chatGLM_6B"},
"image_to_text": {"blip-image-captioning-base"}, "image_to_text": {"blip-image-captioning-base"},
"text_to_image": {"stable-diffusion-xl-base-1.0"},
} }
AITYPE = map[string]string{ AITYPE = map[string]string{
"1": OCTOPUS, "1": OCTOPUS,


Loading…
Cancel
Save