You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

commithpctaskhandler.go 1.3 kB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package hpc
  2. import (
  3. "github.com/zeromicro/go-zero/rest/httpx"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/logic/hpc"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
  9. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
  10. "k8s.io/apimachinery/pkg/util/json"
  11. "net/http"
  12. "strconv"
  13. )
  14. func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15. return func(w http.ResponseWriter, r *http.Request) {
  16. var req types.CommitHpcTaskReq
  17. if err := httpx.Parse(r, &req); err != nil {
  18. result.ParamErrorResult(r, w, err)
  19. return
  20. }
  21. // 获取ip信息
  22. ip := utils.GetClientIP(r)
  23. req.Parameters["UserIp"] = ip
  24. // 获取token信息
  25. token := r.Header.Get("Authorization")
  26. req.Parameters["Token"] = token
  27. // 获取用户信息
  28. userStr := r.Header.Get("User")
  29. user := &models.JccUserInfo{}
  30. json.Unmarshal([]byte(userStr), user)
  31. req.Parameters["UserId"] = strconv.FormatInt(user.Id, 10)
  32. l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx)
  33. resp, err := l.CommitHpcTask(&req)
  34. result.HttpResult(r, w, resp, err)
  35. }
  36. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.