From 2ae5634dc9a46f5dab198f682e63a524c84c83ab Mon Sep 17 00:00:00 2001 From: David Roberts Date: Thu, 17 Aug 2017 15:07:06 +0100 Subject: [PATCH] [ML] Improve error message when auto-close isn't attempted (elastic/x-pack-elasticsearch#2296) The old message of "Cannot auto close job" implied the problem was with closing the job. This change makes it clearer that the problem is that the datafeed could not be stopped and hence auto-close will not even be attempted. Original commit: elastic/x-pack-elasticsearch@065e9930ce6ee8d8234d7001f3cbb05a394d914a --- .../xpack/ml/datafeed/DatafeedManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java index 56aef639e4c..422bda11088 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java @@ -399,8 +399,8 @@ public class DatafeedManager extends AbstractComponent { persistentTasksService.waitForPersistentTaskStatus(taskId, Objects::isNull, TimeValue.timeValueSeconds(20), new WaitForPersistentTaskStatusListener() { @Override - public void onResponse(PersistentTask PersistentTask) { - CloseJobAction.Request closeJobRequest = new CloseJobAction.Request(datafeed.getJobId()); + public void onResponse(PersistentTask persistentTask) { + CloseJobAction.Request closeJobRequest = new CloseJobAction.Request(getJobId()); /* Enforces that for the close job api call the current node is the coordinating node. If we are in this callback then the local node's cluster state doesn't contain a persistent task @@ -420,20 +420,20 @@ public class DatafeedManager extends AbstractComponent { @Override public void onResponse(CloseJobAction.Response response) { if (!response.isClosed()) { - logger.error("[{}] job close action was not acknowledged", datafeed.getJobId()); + logger.error("[{}] job close action was not acknowledged", getJobId()); } } @Override public void onFailure(Exception e) { - logger.error("[" + datafeed.getJobId() + "] failed to auto-close job", e); + logger.error("[" + getJobId() + "] failed to auto-close job", e); } }); } @Override public void onFailure(Exception e) { - logger.error("Cannot auto close job [" + datafeed.getJobId() + "]", e); + logger.error("Failed to remove datafeed persistent task - will not auto close job [" + getJobId() + "]", e); } }); }