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.9 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/jcce-pcm/pcm-coordinator/api/internal/config"
  21. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/cron"
  22. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/handler"
  23. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/mqs"
  24. "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
  25. )
  26. var configFile = flag.String("f", "api/etc/pcm.yaml", "the config file")
  27. func main() {
  28. flag.Parse()
  29. var c config.Config
  30. conf.MustLoad(*configFile, &c)
  31. serviceGroup := service.NewServiceGroup()
  32. defer serviceGroup.Stop()
  33. server := rest.MustNewServer(c.RestConf, rest.WithCors())
  34. ctx := svc.NewServiceContext(c)
  35. // start log component
  36. logx.MustSetup(c.LogConf)
  37. ctx.Cron.Start()
  38. cron.AddCronGroup(ctx)
  39. handler.RegisterHandlers(server, ctx)
  40. serviceGroup.Add(server)
  41. services := []service.Service{
  42. //mqs.MustNewQueue("ai", mqs.NewAiMq(context.Background(), ctx)),
  43. mqs.MustNewQueue("cloud", mqs.NewCloudMq(context.Background(), ctx)),
  44. //mqs.MustNewQueue("hpc", mqs.NewHpcMq(context.Background(), ctx)),
  45. }
  46. for _, mq := range services {
  47. serviceGroup.Add(mq)
  48. }
  49. logx.Infof("Starting server at %s:%d...\n", c.Host, c.Port)
  50. serviceGroup.Start()
  51. }

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.