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.

startdeployinstancelistlogic.go 1.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package inference
  2. import (
  3. "context"
  4. "errors"
  5. "github.com/zeromicro/go-zero/core/logx"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/updater"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  8. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types"
  9. "strconv"
  10. )
  11. type StartDeployInstanceListLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewStartDeployInstanceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartDeployInstanceListLogic {
  17. return &StartDeployInstanceListLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *StartDeployInstanceListLogic) StartDeployInstanceList(req *types.StartDeployInstanceReq) (resp *types.StartDeployInstanceResp, err error) {
  24. resp = &types.StartDeployInstanceResp{}
  25. id, err := strconv.ParseInt(req.Id, 10, 64)
  26. ins, err := l.svcCtx.Scheduler.AiStorages.GetInferDeployInstanceById(id)
  27. if err != nil {
  28. return nil, err
  29. }
  30. l.svcCtx.Scheduler.AiStorages.UpdateInferDeployInstance(ins)
  31. success := l.svcCtx.Scheduler.AiService.InferenceAdapterMap[req.AdapterId][req.ClusterId].StartInferDeployInstance(l.ctx, req.InstanceId)
  32. if !success {
  33. return nil, errors.New("start instance failed")
  34. }
  35. go updater.UpdateDeployInstanceStatus(l.svcCtx, ins)
  36. return resp, nil
  37. }

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.