mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 02:45:42 +03:00
scheduler: track dimension of exhaustion
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user