调度方法修改

Former-commit-id: f19df9d4b146b88ca6d75769e17915184bb036d2
This commit is contained in:
tzwang 2023-11-23 15:09:13 +08:00
parent 1467cc1ace
commit feb444a53b
2 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,10 @@ type ShuguangHpc struct {
participant *models.StorelinkCenter
}
func NewShuguangHpc(ctx context.Context, svcCtx *svc.ServiceContext, participant *models.StorelinkCenter) *ShuguangHpc {
return &ShuguangHpc{ctx: ctx, svcCtx: svcCtx, participant: participant}
}
func (s ShuguangHpc) UploadImage(path string) (interface{}, error) {
//TODO implement me
panic("implement me")

View File

@ -44,7 +44,7 @@ func NewScheduler(scheduleService scheduleService, val string, dbEngin *gorm.DB,
if err != nil {
return nil, errors.New("create scheduler failed : " + err.Error())
}
return &scheduler{task: task, scheduleService: scheduleService, dbEngin: dbEngin, participantRpc: participantRpc}, nil
return &scheduler{task: task, scheduleService: scheduleService, dbEngin: dbEngin, participantRpc: participantRpc, result: make(map[ParticipantId]Replicas, 0)}, nil
}
func (s *scheduler) MatchLabels() {
@ -214,7 +214,7 @@ func (s *scheduler) assignReplicasToResult(strategy *algo.Strategy, providerList
if e == 0 {
continue
}
s.result[ParticipantId(providerList[i].Pid)] = Replicas(e)
s.result[ParticipantId(providerList[i].Pid)] = Replicas(int64(e))
}
if len(s.result) == 0 {