瀏覽代碼

[ML] log minimum diskspace setting if forecast fails due to insufficient d… (#37486)

log minimum disk space setting if forecast fails due to insufficient disk space
Hendrik Muhs 6 年之前
父節點
當前提交
15d1b904a1

+ 8 - 1
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportForecastJobAction.java

@@ -97,8 +97,15 @@ public class TransportForecastJobAction extends TransportJobTaskAction<ForecastJ
             } else if (forecastRequestStats.getStatus() == ForecastRequestStats.ForecastRequestStatus.FAILED) {
                 List<String> 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(

+ 4 - 0
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

+ 4 - 0
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();