소스 검색

[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);
         }