From 67c64a6dfd0eb126d3f4878ab66047d70d5752b4 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Fri, 23 Mar 2018 17:30:10 +0000 Subject: [PATCH] [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@c5169328ee5094ca9bc8e0e0580422648db9ec8b --- .../ml/job/process/autodetect/AutodetectCommunicator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java b/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java index 6c1a3368133..09a7f3c1104 100644 --- a/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java +++ b/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectCommunicator.java @@ -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);