Skip to content

Commit

Permalink
fix gpu stats panic error (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meteriox committed Jun 8, 2023
1 parent 8e8d18b commit 7cb19cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ami/kube/kube_collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ func (k *kubeImpl) CollectNodeStats() (map[string]interface{}, error) {

var nodeStatsMerge map[string]interface{}
if len(gpuExts) > 0 {
if ext, ok := gpuExts[node.Name]; ok {
if ext, ok := gpuExts[node.Name]; ok && ext != nil {
nodeStatsMerge = ext.(map[string]interface{})
}
}
if len(nodeExts) > 0 {
if ext, ok := nodeExts[node.Name]; ok {
if ext, ok := nodeExts[node.Name]; ok && ext != nil {
if nodeStatsMerge == nil {
nodeStatsMerge = make(map[string]interface{}, 0)
}
Expand Down
2 changes: 1 addition & 1 deletion ami/native/native.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ func (impl *nativeImpl) CollectNodeStats() (map[string]interface{}, error) {
}
var nodeStatsMerge map[string]interface{}
if len(gpuExts) > 0 {
if ext, ok := gpuExts[ho.Hostname]; ok {
if ext, ok := gpuExts[ho.Hostname]; ok && ext != nil {
nodeStatsMerge = ext.(map[string]interface{})
}
}
Expand Down

0 comments on commit 7cb19cd

Please sign in to comment.