forked from JointCloud/pcm-coordinator
30 lines
777 B
Go
30 lines
777 B
Go
package core
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/core"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
|
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
|
|
)
|
|
|
|
// 异步提交智算任务
|
|
func AsynCommitAiTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
var req types.AsynCommitAiTaskReq
|
|
if err := httpx.Parse(r, &req); err != nil {
|
|
httpx.ErrorCtx(r.Context(), w, err)
|
|
return
|
|
}
|
|
|
|
l := core.NewAsynCommitAiTaskLogic(r.Context(), svcCtx)
|
|
resp, err := l.AsynCommitAiTask(&req)
|
|
if err != nil {
|
|
httpx.ErrorCtx(r.Context(), w, err)
|
|
} else {
|
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
|
}
|
|
}
|
|
}
|