[ML] Prevent notifications on deletion of a non existent job (#35337)

This commit is contained in:
David Kyle 2018-11-08 09:57:07 +00:00 committed by GitHub
parent 8a85251da0
commit 9494e046e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -64,6 +64,7 @@ import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndexFiel
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.CategorizerState;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshot;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.Quantiles;
import org.elasticsearch.xpack.ml.job.JobManager;
import org.elasticsearch.xpack.ml.job.persistence.JobDataDeleter;
import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider;
import org.elasticsearch.xpack.ml.notifications.Auditor;
@ -136,6 +137,8 @@ public class TransportDeleteJobAction extends TransportMasterNodeAction<DeleteJo
ActionListener<AcknowledgedResponse> listener) {
logger.debug("Deleting job '{}'", request.getJobId());
JobManager.getJobOrThrowIfUnknown(request.getJobId(), state);
TaskId taskId = new TaskId(clusterService.localNode().getId(), task.getId());
ParentTaskAssigningClient parentTaskClient = new ParentTaskAssigningClient(client, taskId);

View File

@ -460,6 +460,13 @@
}
- match: { analysis_limits.model_memory_limit: "30mb" }
---
"Test delete job that does not exist":
- do:
catch: missing
xpack.ml.delete_job:
job_id: not-a-job
---
"Test delete job that is referred by a datafeed":
- do: