调度结构refactor2
This commit is contained in:
parent
eb41726104
commit
2221bb8578
|
@ -40,7 +40,7 @@ func (cs *cloudScheduler) pickOptimalStrategy(task *providerPricing.Task, provid
|
|||
|
||||
//调度算法
|
||||
strategy := strategies.NewPricingStrategy(task, providers...)
|
||||
taskResult, err := strategies.ScheduleWithFullCollaboration(strategy, strategy.ProviderList)
|
||||
taskResult, err := strategy.ScheduleWithFullCollaboration()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -106,18 +106,18 @@ func (ps *pricingStrategy) computeMaxScore() (*providerPricing.Task, error) {
|
|||
return ps.Task, nil
|
||||
}
|
||||
|
||||
type strategyService interface {
|
||||
computeMaxScore() (*providerPricing.Task, error)
|
||||
}
|
||||
//type strategyService interface {
|
||||
// computeMaxScore() (*providerPricing.Task, error)
|
||||
//}
|
||||
|
||||
func ScheduleWithFullCollaboration(strategyService strategyService, ProviderList []*providerPricing.Provider) (*providerPricing.Task, error) {
|
||||
task, err := strategyService.computeMaxScore()
|
||||
func (ps *pricingStrategy) ScheduleWithFullCollaboration() (*providerPricing.Task, error) {
|
||||
task, err := ps.computeMaxScore()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//计算任务i的resourcePerTask属性
|
||||
for i, _ := range ProviderList {
|
||||
for i, _ := range ps.ProviderList {
|
||||
tasksolu := task.MaxscoreStrategy.Tasksolution[i] // 第j个提供商分到的任务数
|
||||
resourcesolu := task.MaxscoreStrategy.Resourcesolution[0][i] // 第j个提供商分到的资源数
|
||||
|
||||
|
|
Loading…
Reference in New Issue