mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-12-13 07:46:43 +00:00
update
This commit is contained in:
@@ -14,6 +14,8 @@ type Evaluator struct {
|
||||
factorNode float64
|
||||
factorRack float64
|
||||
factorDomain float64
|
||||
|
||||
factorPack float64
|
||||
}
|
||||
|
||||
func (eva *Evaluator) init(nodes []NodeStatus, tasks []Task) {
|
||||
@@ -28,6 +30,7 @@ func (eva *Evaluator) init(nodes []NodeStatus, tasks []Task) {
|
||||
eva.factorDomain = 40.0
|
||||
eva.costNetwork = 0.0
|
||||
eva.costLoad = 0.0
|
||||
eva.factorPack = -1.0
|
||||
}
|
||||
|
||||
func (eva *Evaluator) add(node NodeStatus, task Task) {
|
||||
@@ -116,10 +119,7 @@ func (eva *Evaluator) remove(node NodeStatus, task Task) {
|
||||
}
|
||||
|
||||
func (eva *Evaluator) calculate() float64 {
|
||||
/* factor to determine spread or pack */
|
||||
/* 1.0 spread, -1.0 pack */
|
||||
factor := -1.0
|
||||
return eva.costNetwork + factor*eva.costLoad/float64(eva.totalPS+eva.totalWorker)
|
||||
return eva.costNetwork + eva.factorPack*eva.costLoad/float64(eva.totalPS+eva.totalWorker)
|
||||
}
|
||||
|
||||
func evaluate(allocation Allocation) float64 {
|
||||
|
||||
@@ -67,6 +67,11 @@ func fastBestFit(nodes []NodeStatus, tasks []Task) Allocation {
|
||||
for _, task := range tasks {
|
||||
minCost := math.MaxFloat64
|
||||
var best *NodeStatus
|
||||
if task.IsPS {
|
||||
eva.factorPack = -1.0
|
||||
} else {
|
||||
eva.factorPack = 1.0
|
||||
}
|
||||
for i, node := range nodes {
|
||||
if _, ok := allocation.TasksOnNode[node.ClientID]; !ok {
|
||||
allocation.TasksOnNode[node.ClientID] = []Task{}
|
||||
|
||||
Reference in New Issue
Block a user