[ML] Return error when process cause has been killed (elastic/x-pack-elasticsearch#4211)

relates elastic/x-pack-elasticsearch#4210

Original commit: elastic/x-pack-elasticsearch@c5169328ee
This commit is contained in:
Dimitris Athanasiou 2018-03-23 17:30:10 +00:00 committed by GitHub
parent 5f219bd70f
commit 67c64a6dfd
1 changed files with 4 additions and 2 deletions

View File

@ -345,7 +345,8 @@ public class AutodetectCommunicator implements Closeable {
@Override
public void onFailure(Exception e) {
if (processKilled) {
handler.accept(null, null);
handler.accept(null, ExceptionsHelper.conflictStatusException(
"[{}] Could not submit operation to process as it has been killed", job.getId()));
} else {
LOGGER.error(new ParameterizedMessage("[{}] Unexpected exception writing to process", job.getId()), e);
handler.accept(null, e);
@ -355,7 +356,8 @@ public class AutodetectCommunicator implements Closeable {
@Override
protected void doRun() throws Exception {
if (processKilled) {
handler.accept(null, null);
handler.accept(null, ExceptionsHelper.conflictStatusException(
"[{}] Could not submit operation to process as it has been killed", job.getId()));
} else {
checkProcessIsAlive();
handler.accept(operation.get(), null);