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.

pcm.go 1.8 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Copyright (c) [2023] [pcm]
  3. [pcm-coordinator] is licensed under Mulan PSL v2.
  4. You can use this software according to the terms and conditions of the Mulan PSL v2.
  5. You may obtain a copy of Mulan PSL v2 at:
  6. http://license.coscl.org.cn/MulanPSL2
  7. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  8. EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  9. MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  10. See the Mulan PSL v2 for more details.
  11. */
  12. package main
  13. import (
  14. "context"
  15. "flag"
  16. "github.com/zeromicro/go-zero/core/conf"
  17. "github.com/zeromicro/go-zero/core/logx"
  18. "github.com/zeromicro/go-zero/core/service"
  19. "github.com/zeromicro/go-zero/rest"
  20. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/config"
  21. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler"
  22. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/mqs"
  23. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
  24. )
  25. var configFile = flag.String("f", "api/etc/pcm.yaml", "the config file")
  26. func main() {
  27. flag.Parse()
  28. var c config.Config
  29. conf.MustLoad(*configFile, &c)
  30. serviceGroup := service.NewServiceGroup()
  31. defer serviceGroup.Stop()
  32. server := rest.MustNewServer(c.RestConf, rest.WithCors())
  33. ctx := svc.NewServiceContext(c)
  34. // start log component
  35. logx.MustSetup(c.LogConf)
  36. handler.RegisterHandlers(server, ctx)
  37. serviceGroup.Add(server)
  38. services := []service.Service{
  39. //mqs.MustNewQueue("ai", mqs.NewAiMq(context.Background(), ctx)),
  40. mqs.MustNewQueue("cloud", mqs.NewCloudMq(context.Background(), ctx)),
  41. //mqs.MustNewQueue("hpc", mqs.NewHpcMq(context.Background(), ctx)),
  42. }
  43. for _, mq := range services {
  44. serviceGroup.Add(mq)
  45. }
  46. logx.Infof("Starting server at %s:%d...\n", c.Host, c.Port)
  47. serviceGroup.Start()
  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.