From 63a3fd87fe8e6350dcf49b557e864a3b612e76f7 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Fri, 12 Aug 2022 19:01:39 +0300 Subject: [PATCH] [ML] Improve reason when autoscaling capacity cannot be computed (#89316) When we cannot compute autoscaling capacity we call `MlAutoscalingDeciderService.buildDecisionAndRequestRefresh`. There are 4 callers. 3 of them set their own specific reason before the call. However, the method overwrites the reason with the generic `MEMORY_STALE` msg. This commit addresses this issue which should bubble up more detailed reasons for those edge cases. --- .../xpack/ml/autoscaling/MlAutoscalingDeciderService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlAutoscalingDeciderService.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlAutoscalingDeciderService.java index 83cabd49c79c1..1e613d57b93e1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlAutoscalingDeciderService.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/autoscaling/MlAutoscalingDeciderService.java @@ -507,7 +507,7 @@ public AutoscalingDeciderResult scale(Settings configuration, AutoscalingDecider "view of job memory is stale given duration [{}]. Not attempting to make scaling decision", mlMemoryTracker.getStalenessDuration() ); - return buildDecisionAndRequestRefresh(reasonBuilder); + return buildDecisionAndRequestRefresh(reasonBuilder.setSimpleReason(MEMORY_STALE)); } // We need the current node loads to determine if we need to scale up or down List nodeLoads = new ArrayList<>(mlNodes.size()); @@ -1163,7 +1163,7 @@ Optional calculateFutureAvailableCapacity(PersistentTasksC private AutoscalingDeciderResult buildDecisionAndRequestRefresh(MlScalingReason.Builder reasonBuilder) { mlMemoryTracker.asyncRefresh(); - return new AutoscalingDeciderResult(null, reasonBuilder.setSimpleReason(MEMORY_STALE).build()); + return new AutoscalingDeciderResult(null, reasonBuilder.build()); } private Long getAnalyticsMemoryRequirement(String analyticsId) {