Skip to content

Commit

Permalink
Fix NPE in MlMemoryAutoscalingDecider (elastic#116650) (elastic#116743)
Browse files Browse the repository at this point in the history
* Fix NPE in MlMemoryAutoscalingDecider

* Update docs/changelog/116650.yaml

* Update 116650.yaml

* Update docs/changelog/116650.yaml

* better fix
  • Loading branch information
jan-elastic authored Nov 13, 2024
1 parent a917d16 commit 777d774
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/116650.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 116650
summary: Fix bug in ML autoscaling when some node info is unavailable
area: Machine Learning
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public static Builder builder(ByteSizeValue nodeSize, ByteSizeValue tierSize) {
}

public static Builder from(AutoscalingCapacity autoscalingCapacity) {
return builder(autoscalingCapacity.node().memory(), autoscalingCapacity.total().memory());
if (autoscalingCapacity == null) {
return builder(null, null);
} else {
return builder(autoscalingCapacity.node().memory(), autoscalingCapacity.total().memory());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ static MlMemoryAutoscalingCapacity ensureScaleDown(
MlMemoryAutoscalingCapacity scaleDownResult,
MlMemoryAutoscalingCapacity currentCapacity
) {
if (scaleDownResult == null || currentCapacity == null) {
if (scaleDownResult == null || currentCapacity == null || currentCapacity.isUndetermined()) {
return null;
}
MlMemoryAutoscalingCapacity newCapacity = MlMemoryAutoscalingCapacity.builder(
Expand Down

0 comments on commit 777d774

Please sign in to comment.