[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@4617375431e6c435f996b9709cb352f3543f15db
@@ -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);
