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 2.0 kB

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

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.