diff --git a/internal/handler/inference/getrunninginstancebymodelhandler.go b/internal/handler/inference/getrunninginstancebymodelhandler.go new file mode 100644 index 00000000..534796c9 --- /dev/null +++ b/internal/handler/inference/getrunninginstancebymodelhandler.go @@ -0,0 +1,28 @@ +package inference + +import ( + "net/http" + + "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" +) + +func GetRunningInstanceByModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetRunningInstanceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := inference.NewGetRunningInstanceByModelLogic(r.Context(), svcCtx) + resp, err := l.GetRunningInstanceByModel(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/logic/inference/getrunninginstancebymodellogic.go b/internal/logic/inference/getrunninginstancebymodellogic.go new file mode 100644 index 00000000..7ffef4c7 --- /dev/null +++ b/internal/logic/inference/getrunninginstancebymodellogic.go @@ -0,0 +1,30 @@ +package inference + +import ( + "context" + + "gitlink.org.cn/tzwang/pcm-coordinator/internal/svc" + "gitlink.org.cn/tzwang/pcm-coordinator/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetRunningInstanceByModelLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewGetRunningInstanceByModelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRunningInstanceByModelLogic { + return &GetRunningInstanceByModelLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *GetRunningInstanceByModelLogic) GetRunningInstanceByModel(req *types.GetRunningInstanceReq) (resp *types.GetRunningInstanceResp, err error) { + // todo: add your logic here and delete this line + + return +}