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.

schedulesubmitlogic.go 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package schedule
  2. import (
  3. "context"
  4. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/schedulers"
  5. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/schedulers/option"
  6. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
  7. "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type ScheduleSubmitLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewScheduleSubmitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ScheduleSubmitLogic {
  16. return &ScheduleSubmitLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *ScheduleSubmitLogic) ScheduleSubmit(req *types.ScheduleReq) (resp *types.ScheduleResp, err error) {
  23. resp = &types.ScheduleResp{}
  24. opt := &option.AiOption{
  25. ResourceType: req.AiOption.ResourceType,
  26. Tops: 0,
  27. TaskType: req.AiOption.TaskType,
  28. DatasetsName: req.AiOption.Datasets,
  29. //AlgorithmName: "cnn",
  30. StrategyName: req.AiOption.Strategy,
  31. ClusterToStaticWeight: nil,
  32. Params: []string{
  33. "epoch,1",
  34. },
  35. }
  36. aiSchdl, err := schedulers.NewAiScheduler(l.ctx, "", l.svcCtx.Scheduler, opt)
  37. if err != nil {
  38. return nil, err
  39. }
  40. _, err = l.svcCtx.Scheduler.AssignAndSchedule(aiSchdl)
  41. if err != nil {
  42. return nil, err
  43. }
  44. return resp, nil
  45. }

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.