Selaa lähdekoodia

Update the NodeMap with default cost data on failure (#1905)

Signed-off-by: Matt Bolt <mbolt35@gmail.com>
Matt Bolt 3 vuotta sitten
vanhempi
sitoutus
23e33788f6
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      pkg/costmodel/allocation_helpers.go

+ 4 - 1
pkg/costmodel/allocation_helpers.go

@@ -1642,7 +1642,10 @@ func (cm *CostModel) getNodePricing(nodeMap map[nodeKey]*nodePricing, nodeKey no
 		if nodeKey.Node != "" {
 		if nodeKey.Node != "" {
 			log.DedupedWarningf(5, "CostModel: failed to find node for %s", nodeKey)
 			log.DedupedWarningf(5, "CostModel: failed to find node for %s", nodeKey)
 		}
 		}
-		return cm.getCustomNodePricing(false, "")
+		// since the node pricing data is not found, and this won't change for the duration of the allocation
+		// build process, we can update the node map with the defaults to prevent future failed lookups
+		nodeMap[nodeKey] = cm.getCustomNodePricing(false, "")
+		return nodeMap[nodeKey]
 	}
 	}
 
 
 	// If custom pricing is enabled and can be retrieved, override detected
 	// If custom pricing is enabled and can be retrieved, override detected