mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Track top k nodes by norm score rather than top k nodes per scorer
This commit is contained in:
@@ -374,11 +374,24 @@ func formatAllocMetrics(metrics *api.AllocationMetric, scores bool, prefix strin
|
||||
// Print scores
|
||||
if scores {
|
||||
if len(metrics.ScoreMetaData) > 0 {
|
||||
for scorer, scoreMeta := range metrics.ScoreMetaData {
|
||||
for _, nodeScore := range scoreMeta {
|
||||
out += fmt.Sprintf("%s* Scorer %q, Node %q = %f\n", prefix, scorer, nodeScore.NodeID, nodeScore.Score)
|
||||
scoreOutput := make([]string, len(metrics.ScoreMetaData)+1)
|
||||
|
||||
for i, scoreMeta := range metrics.ScoreMetaData {
|
||||
// Add header as first row
|
||||
if i == 0 {
|
||||
scoreOutput[0] = "Node|"
|
||||
for scorerName, _ := range scoreMeta.Scores {
|
||||
scoreOutput[0] += fmt.Sprintf("%v|", scorerName)
|
||||
}
|
||||
scoreOutput[0] += "Final Score"
|
||||
}
|
||||
scoreOutput[i+1] = fmt.Sprintf("%v|", scoreMeta.NodeID)
|
||||
for _, scoreVal := range scoreMeta.Scores {
|
||||
scoreOutput[i+1] += fmt.Sprintf("%v|", scoreVal)
|
||||
}
|
||||
scoreOutput[i+1] += fmt.Sprintf("%v", scoreMeta.NormScore)
|
||||
}
|
||||
out += formatList(scoreOutput)
|
||||
} else {
|
||||
// Backwards compatibility for old allocs
|
||||
for name, score := range metrics.Scores {
|
||||
|
||||
Reference in New Issue
Block a user