parent
543319f966
commit
71149fb6d4
|
@ -249,8 +249,13 @@ public class CloseJobAction extends Action<CloseJobAction.Request, CloseJobActio
|
||||||
ClusterState currentState = clusterService.state();
|
ClusterState currentState = clusterService.state();
|
||||||
if (request.isForce()) {
|
if (request.isForce()) {
|
||||||
PersistentTasksCustomMetaData tasks = currentState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
|
PersistentTasksCustomMetaData tasks = currentState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
|
||||||
PersistentTask<?> jobTask = MlMetadata.getJobTask(request.getJobId(), tasks);
|
String jobId = request.getJobId();
|
||||||
forceCloseJob(jobTask.getId(), request.getJobId(), listener);
|
PersistentTask<?> jobTask = MlMetadata.getJobTask(jobId, tasks);
|
||||||
|
if (jobTask == null) {
|
||||||
|
throw new ElasticsearchStatusException("cannot force close job, because job [" + jobId + "] is not open",
|
||||||
|
RestStatus.CONFLICT);
|
||||||
|
}
|
||||||
|
forceCloseJob(jobTask.getId(), jobId, listener);
|
||||||
} else {
|
} else {
|
||||||
PersistentTask<?> jobTask = validateAndReturnJobTask(request.getJobId(), currentState);
|
PersistentTask<?> jobTask = validateAndReturnJobTask(request.getJobId(), currentState);
|
||||||
normalCloseJob(task, jobTask.getId(), request, listener);
|
normalCloseJob(task, jobTask.getId(), request, listener);
|
||||||
|
|
Loading…
Reference in New Issue