[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@065e9930ce
This commit is contained in:
David Roberts 2017-08-17 15:07:06 +01:00 committed by GitHub
parent 44857d71b3
commit 2ae5634dc9
1 changed files with 5 additions and 5 deletions

View File

@ -399,8 +399,8 @@ public class DatafeedManager extends AbstractComponent {
persistentTasksService.waitForPersistentTaskStatus(taskId, Objects::isNull, TimeValue.timeValueSeconds(20),
new WaitForPersistentTaskStatusListener<StartDatafeedAction.DatafeedParams>() {
@Override
public void onResponse(PersistentTask<StartDatafeedAction.DatafeedParams> PersistentTask) {
CloseJobAction.Request closeJobRequest = new CloseJobAction.Request(datafeed.getJobId());
public void onResponse(PersistentTask<StartDatafeedAction.DatafeedParams> 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);
}
});
}