[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 @Override
public void onFailure(Exception e) { public void onFailure(Exception e) {
if (processKilled) { 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 { } else {
LOGGER.error(new ParameterizedMessage("[{}] Unexpected exception writing to process", job.getId()), e); LOGGER.error(new ParameterizedMessage("[{}] Unexpected exception writing to process", job.getId()), e);
handler.accept(null, e); handler.accept(null, e);
@ -355,7 +356,8 @@ public class AutodetectCommunicator implements Closeable {
@Override @Override
protected void doRun() throws Exception { protected void doRun() throws Exception {
if (processKilled) { 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 { } else {
checkProcessIsAlive(); checkProcessIsAlive();
handler.accept(operation.get(), null); handler.accept(operation.get(), null);