Преглед на файлове

[ML] data frame analytics inference improvements (#59442)

* [ML] data frame analytics inference improvements
this commit prevents the model from being cached unnecessarily.
it also keeps the model bytes from being removed from the circuit breaker
until inference is complete.
Benjamin Trent преди 5 години
родител
ревизия
f48d3838c0
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/inference/InferenceRunner.java

+ 4 - 3
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/inference/InferenceRunner.java

@@ -73,10 +73,11 @@ public class InferenceRunner {
         LOGGER.info("[{}] Started inference on test data against model [{}]", config.getId(), modelId);
         try {
             PlainActionFuture<LocalModel> localModelPlainActionFuture = new PlainActionFuture<>();
-            modelLoadingService.getModelForSearch(modelId, localModelPlainActionFuture);
-            LocalModel localModel = localModelPlainActionFuture.actionGet();
+            modelLoadingService.getModelForPipeline(modelId, localModelPlainActionFuture);
             TestDocsIterator testDocsIterator = new TestDocsIterator(new OriginSettingClient(client, ClientHelper.ML_ORIGIN), config);
-            inferTestDocs(localModel, testDocsIterator);
+            try (LocalModel localModel = localModelPlainActionFuture.actionGet()) {
+                inferTestDocs(localModel, testDocsIterator);
+            }
         } catch (Exception e) {
             throw ExceptionsHelper.serverError("[{}] failed running inference on model [{}]", e, config.getId(), modelId);
         }