scheduler: track dimension of exhaustion

This commit is contained in:
Armon Dadgar
2015-09-13 16:48:01 -07:00
parent 65cd3b4ca7
commit d70dcecdaf
2 changed files with 13 additions and 4 deletions

View File

@@ -977,6 +977,9 @@ type AllocMetric struct {
// ClassExhausted is the number of nodes exhausted by class
ClassExhausted map[string]int
// DimensionExhaused provides the count by dimension or reason
DimensionExhaused map[string]int
// Scores is the scores of the final few nodes remaining
// for placement. The top score is typically selected.
Scores map[string]float64
@@ -1012,7 +1015,7 @@ func (a *AllocMetric) FilterNode(node *Node, constraint string) {
}
}
func (a *AllocMetric) ExhaustedNode(node *Node) {
func (a *AllocMetric) ExhaustedNode(node *Node, dimension string) {
a.NodesExhausted += 1
if node != nil && node.NodeClass != "" {
if a.ClassExhausted == nil {
@@ -1020,6 +1023,12 @@ func (a *AllocMetric) ExhaustedNode(node *Node) {
}
a.ClassExhausted[node.NodeClass] += 1
}
if dimension != "" {
if a.DimensionExhaused == nil {
a.DimensionExhaused = make(map[string]int)
}
a.DimensionExhaused[dimension] += 1
}
}
func (a *AllocMetric) ScoreNode(node *Node, name string, score float64) {

View File

@@ -191,8 +191,8 @@ OUTER:
ask := taskResources.Networks[0]
offer, err := netIdx.AssignNetwork(ask)
if offer == nil {
iter.ctx.Metrics().FilterNode(option.Node,
fmt.Sprintf("failed network offer: %s", err))
iter.ctx.Metrics().ExhaustedNode(option.Node,
fmt.Sprintf("network: %s", err))
continue OUTER
}
@@ -216,7 +216,7 @@ OUTER:
// Check if these allocations fit, if they do not, simply skip this node
fit, util, _ := structs.AllocsFit(option.Node, proposed, netIdx)
if !fit {
iter.ctx.Metrics().ExhaustedNode(option.Node)
iter.ctx.Metrics().ExhaustedNode(option.Node, "resources")
continue
}