[ML] Correctly fetch persistent tasks in JobUpdateAction

Original commit: elastic/x-pack-elasticsearch@440bfdd06e
This commit is contained in:
Dimitrios Athanasiou 2017-02-22 11:19:35 +00:00
parent 614aeeeb53
commit b233c4729d

View File

@ -168,7 +168,7 @@ public class UpdateJobAction extends Action<UpdateJobAction.Request, PutJobActio
throw new IllegalArgumentException("Job Id " + Job.ALL + " cannot be for update");
}
PersistentTasksInProgress tasks = clusterService.state().custom(PersistentTasksInProgress.TYPE);
PersistentTasksInProgress tasks = clusterService.state().getMetaData().custom(PersistentTasksInProgress.TYPE);
boolean jobIsOpen = MlMetadata.getJobState(request.getJobId(), tasks) == JobState.OPENED;
semaphoreByJob.computeIfAbsent(request.getJobId(), id -> new Semaphore(1)).acquire();
@ -181,8 +181,7 @@ public class UpdateJobAction extends Action<UpdateJobAction.Request, PutJobActio
releaseJobSemaphore(request.getJobId());
listener.onFailure(e);
});
}
else {
} else {
wrappedListener = ActionListener.wrap(
response -> {
releaseJobSemaphore(request.getJobId());