[ML] Ignore ResourceNotFoundException executing C++ process update (elastic/x-pack-elasticsearch#927)

When this happens it means the job has been deleted, which in turn means
the C++ process has been stopped, so there's no need to send it a message
and hence no problem worth logging a stack trace for.

This differs from elastic/x-pack-elasticsearch#896 because elastic/x-pack-elasticsearch#896 was for a similar situation with
closed jobs, whereas this one is for deleted jobs.

Original commit: elastic/x-pack-elasticsearch@9bb4e98fe7
This commit is contained in:
David Roberts 2017-04-03 10:53:32 +01:00 committed by GitHub
parent 30745b8dd7
commit c5a2fba70a
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@
package org.elasticsearch.xpack.ml.job;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.LocalNodeMasterListener;
@ -108,7 +109,10 @@ public class UpdateJobProcessNotifier extends AbstractComponent
@Override
public void onFailure(Exception e) {
if (e.getMessage().contains("because job [" + update.getJobId() +
if (e instanceof ResourceNotFoundException) {
logger.debug("Remote job [{}] not updated as it has been deleted",
update.getJobId());
} else if (e.getMessage().contains("because job [" + update.getJobId() +
"] is not open") && e instanceof ElasticsearchStatusException) {
logger.debug("Remote job [{}] not updated as it is no longer open",
update.getJobId());