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.

inferencetaskdetaillogic.go 1.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package inference
  2. import (
  3. "context"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type InferenceTaskDetailLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewInferenceTaskDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InferenceTaskDetailLogic {
  15. return &InferenceTaskDetailLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. }
  20. }
  21. func (l *InferenceTaskDetailLogic) InferenceTaskDetail(req *types.InferenceTaskDetailReq) (resp *types.InferenceTaskDetailResp, err error) {
  22. // todo: add your logic here and delete this line
  23. var taskAiSub []*models.TaskAiSub
  24. var results []types.InferenceResult
  25. l.svcCtx.DbEngin.Table("task_ai_sub").Where("task_id", req.TaskId).Scan(&taskAiSub)
  26. if len(taskAiSub) != 0 {
  27. for _, sub := range taskAiSub {
  28. result := types.InferenceResult{
  29. TaskName: sub.TaskName,
  30. TaskAiName: sub.TaskAiName,
  31. ImageName: sub.ImageName,
  32. Result: sub.Result,
  33. Card: sub.Card,
  34. ClusterName: sub.ClusterName,
  35. }
  36. results = append(results, result)
  37. }
  38. } else {
  39. return nil, nil
  40. }
  41. resp = &types.InferenceTaskDetailResp{
  42. Code: 200,
  43. Msg: "success",
  44. InferenceResults: results,
  45. }
  46. return resp, nil
  47. }

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.