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.

deployInstance.go 1.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package updater
  2. import (
  3. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/storeLink"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
  7. "net/http"
  8. "strconv"
  9. )
  10. func UpdateDeployInstanceStatus(svc *svc.ServiceContext, instance *models.AiInferDeployInstance) {
  11. amap, found := svc.Scheduler.AiService.InferenceAdapterMap[strconv.FormatInt(instance.AdapterId, 10)]
  12. if !found {
  13. return
  14. }
  15. cmap, found := amap[strconv.FormatInt(instance.ClusterId, 10)]
  16. if !found {
  17. return
  18. }
  19. h := http.Request{}
  20. ins, err := cmap.GetInferDeployInstance(h.Context(), instance.InstanceId)
  21. if err != nil {
  22. return
  23. }
  24. switch instance.ClusterType {
  25. case storeLink.TYPE_OCTOPUS:
  26. switch ins.Status {
  27. case "running":
  28. instance.Status = constants.Running
  29. case "stopped":
  30. instance.Status = constants.Stopped
  31. default:
  32. instance.Status = ins.Status
  33. }
  34. case storeLink.TYPE_SHUGUANGAI:
  35. switch ins.Status {
  36. case "running":
  37. instance.Status = constants.Running
  38. case "Terminated":
  39. instance.Status = constants.Stopped
  40. default:
  41. instance.Status = ins.Status
  42. }
  43. }
  44. err = svc.Scheduler.AiStorages.UpdateInferDeployInstance(instance)
  45. if err != nil {
  46. return
  47. }
  48. }

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.