From 15d1b904a1a053c3d26072c604fa2ff0026bc87e Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Wed, 16 Jan 2019 08:10:13 +0100 Subject: [PATCH] =?UTF-8?q?[ML]=20log=20minimum=20diskspace=20setting=20if?= =?UTF-8?q?=20forecast=20fails=20due=20to=20insufficient=20d=E2=80=A6=20(#?= =?UTF-8?q?37486)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit log minimum disk space setting if forecast fails due to insufficient disk space --- .../xpack/ml/action/TransportForecastJobAction.java | 9 ++++++++- .../job/process/autodetect/AutodetectProcessManager.java | 4 ++++ .../xpack/ml/process/NativeStorageProvider.java | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportForecastJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportForecastJobAction.java index 6bcadf1ddb0..3a26f9f863c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportForecastJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportForecastJobAction.java @@ -97,8 +97,15 @@ public class TransportForecastJobAction extends TransportJobTaskAction messages = forecastRequestStats.getMessages(); if (messages.size() > 0) { + String message = messages.get(0); + + // special case: if forecast failed due to insufficient disk space, log the setting + if (message.contains("disk space is insufficient")) { + message += " Minimum disk space required: [" + processManager.getMinLocalStorageAvailable() + "]"; + } + listener.onFailure(ExceptionsHelper.badRequestException("Cannot run forecast: " - + messages.get(0))); + + message)); } else { // paranoia case, it should not be possible to have an empty message list listener.onFailure( diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java index ef03b4f9e71..fb6e9d46f40 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java @@ -749,6 +749,10 @@ public class AutodetectProcessManager { return autoDetectWorkerExecutor; } + public ByteSizeValue getMinLocalStorageAvailable() { + return nativeStorageProvider.getMinLocalStorageAvailable(); + } + /* * The autodetect native process can only handle a single operation at a time. In order to guarantee that, all * operations are initially added to a queue and a worker thread from ml autodetect threadpool will process each diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/process/NativeStorageProvider.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/process/NativeStorageProvider.java index 1f9aee7bbee..9f366ab1131 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/process/NativeStorageProvider.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/process/NativeStorageProvider.java @@ -111,6 +111,10 @@ public class NativeStorageProvider { } } + public ByteSizeValue getMinLocalStorageAvailable() { + return minLocalStorageAvailable; + } + long getUsableSpace(Path path) throws IOException { long freeSpaceInBytes = Environment.getFileStore(path).getUsableSpace();