formatted the code
This commit is contained in:
parent
f6ec974182
commit
81d795f197
4 changed files with 113 additions and 111 deletions
|
@ -47,7 +47,6 @@ func UpdateCapMargin(new_cap_margin float64) bool {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Threshold factor that would make (Cap_margin * task.Watts) equal to (60/100 * task.Watts).
|
||||
var Starvation_factor = 0.8
|
||||
|
||||
|
@ -73,14 +72,14 @@ func AddTotalPowerForHost(host string, total_power float64) bool {
|
|||
}
|
||||
|
||||
// Window size for running average
|
||||
var Window_size = 160
|
||||
var Window_size = 10
|
||||
|
||||
// Update the window size.
|
||||
func UpdateWindowSize(new_window_size int) bool {
|
||||
// Validation
|
||||
if new_window_size == 0 {
|
||||
return false
|
||||
} else{
|
||||
} else {
|
||||
Window_size = new_window_size
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -118,6 +118,9 @@ A recapping strategy which decides between 2 different recapping schemes.
|
|||
2. A scheme based on the average of the loads on each node in the cluster.
|
||||
|
||||
The recap value picked the least among the two.
|
||||
|
||||
The cleverRecap scheme works well when the cluster is relatively idle and until then,
|
||||
the primitive recapping scheme works better.
|
||||
*/
|
||||
func (capper clusterwideCapper) cleverRecap(total_power map[string]float64,
|
||||
task_monitor map[string][]def.Task, finished_taskId string) (float64, error) {
|
||||
|
@ -148,12 +151,12 @@ func (capper clusterwideCapper) cleverRecap(total_power map[string]float64,
|
|||
// Not considering this task for the computation of total_allocated_power and total_running_tasks
|
||||
continue
|
||||
}
|
||||
watts_usages[host] = append(watts_usages[host], float64(task.Watts) * constants.Cap_margin)
|
||||
watts_usages[host] = append(watts_usages[host], float64(task.Watts)*constants.Cap_margin)
|
||||
}
|
||||
}
|
||||
|
||||
// Updating task monitor. If recap(...) has deleted the finished task from the taskMonitor,
|
||||
// then this will be ignored.
|
||||
// then this will be ignored. Else (this is only when an error occured with recap(...)), we remove it here.
|
||||
if host_of_finished_task != "" && index_of_finished_task != -1 {
|
||||
log.Printf("Removing task with task [%s] from the list of running tasks\n",
|
||||
task_monitor[host_of_finished_task][index_of_finished_task].TaskID)
|
||||
|
@ -177,7 +180,7 @@ func (capper clusterwideCapper) cleverRecap(total_power map[string]float64,
|
|||
for _, usage := range usages {
|
||||
total_usage += usage
|
||||
}
|
||||
loads = append(loads, total_usage / total_power[host])
|
||||
loads = append(loads, total_usage/total_power[host])
|
||||
}
|
||||
|
||||
// Now need to compute the average load.
|
||||
|
|
Reference in a new issue