[ML] Reinstate DatafeedJobsIT::testRealtime_multipleStopCalls test (elastic/x-pack-elasticsearch#1542)
* Handle exception in action Original commit: elastic/x-pack-elasticsearch@2c2f28115f
This commit is contained in:
parent
1bfc864193
commit
6befa83337
|
@ -366,20 +366,29 @@ public class StopDatafeedAction
|
||||||
ActionListener<Response> listener) {
|
ActionListener<Response> listener) {
|
||||||
DatafeedState taskStatus = DatafeedState.STOPPING;
|
DatafeedState taskStatus = DatafeedState.STOPPING;
|
||||||
datafeedTaskTask.updatePersistentStatus(taskStatus, ActionListener.wrap(task -> {
|
datafeedTaskTask.updatePersistentStatus(taskStatus, ActionListener.wrap(task -> {
|
||||||
// we need to fork because we are now on a network threadpool
|
// we need to fork because we are now on a network threadpool
|
||||||
threadPool.executor(MachineLearning.UTILITY_THREAD_POOL_NAME).execute(new AbstractRunnable() {
|
threadPool.executor(MachineLearning.UTILITY_THREAD_POOL_NAME).execute(new AbstractRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Exception e) {
|
public void onFailure(Exception e) {
|
||||||
listener.onFailure(e);
|
listener.onFailure(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doRun() throws Exception {
|
protected void doRun() throws Exception {
|
||||||
datafeedTaskTask.stop("stop_datafeed (api)", request.getStopTimeout());
|
datafeedTaskTask.stop("stop_datafeed (api)", request.getStopTimeout());
|
||||||
listener.onResponse(new Response(true));
|
listener.onResponse(new Response(true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
e -> {
|
||||||
|
if (e instanceof ResourceNotFoundException) {
|
||||||
|
// the task has disappeared so must have stopped
|
||||||
|
listener.onResponse(new Response(true));
|
||||||
|
} else {
|
||||||
|
listener.onFailure(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
));
|
||||||
}, listener::onFailure));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendResponseOrFailure(String datafeedId, ActionListener<Response> listener,
|
private void sendResponseOrFailure(String datafeedId, ActionListener<Response> listener,
|
||||||
|
|
|
@ -110,7 +110,6 @@ public class DatafeedJobsIT extends MlNativeAutodetectIntegTestCase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl="https://github.com/elastic/x-pack-elasticsearch/issues/1536")
|
|
||||||
public void testRealtime_multipleStopCalls() throws Exception {
|
public void testRealtime_multipleStopCalls() throws Exception {
|
||||||
String jobId = "realtime-job-multiple-stop";
|
String jobId = "realtime-job-multiple-stop";
|
||||||
final String datafeedId = jobId + "-datafeed";
|
final String datafeedId = jobId + "-datafeed";
|
||||||
|
|
Loading…
Reference in New Issue