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