mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-12-12 23:36:44 +00:00
update
This commit is contained in:
@@ -15,7 +15,7 @@ type Evaluator struct {
|
||||
factorRack float64
|
||||
factorDomain float64
|
||||
|
||||
factorPack float64
|
||||
factorSpread float64
|
||||
}
|
||||
|
||||
func (eva *Evaluator) init(nodes []NodeStatus, tasks []Task) {
|
||||
@@ -30,7 +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
|
||||
eva.factorSpread = -1.0
|
||||
}
|
||||
|
||||
func (eva *Evaluator) add(node NodeStatus, task Task) {
|
||||
@@ -109,7 +109,7 @@ func (eva *Evaluator) remove(node NodeStatus, task Task) {
|
||||
}
|
||||
|
||||
func (eva *Evaluator) calculate() float64 {
|
||||
return eva.costNetwork + eva.factorPack*eva.costLoad/float64(eva.totalPS+eva.totalWorker)
|
||||
return eva.costNetwork + eva.factorSpread*eva.costLoad/float64(eva.totalPS+eva.totalWorker)
|
||||
}
|
||||
|
||||
func evaluate(allocation Allocation) float64 {
|
||||
|
||||
@@ -68,9 +68,9 @@ func fastBestFit(nodes []NodeStatus, tasks []Task) Allocation {
|
||||
minCost := math.MaxFloat64
|
||||
var best *NodeStatus
|
||||
if task.IsPS {
|
||||
eva.factorPack = -1.0
|
||||
eva.factorSpread = 1.0
|
||||
} else {
|
||||
eva.factorPack = 1.0
|
||||
eva.factorSpread = -1.0
|
||||
}
|
||||
for i, node := range nodes {
|
||||
if _, ok := allocation.TasksOnNode[node.ClientID]; !ok {
|
||||
|
||||
Reference in New Issue
Block a user