Removed unneeded task (de)registering as the super class does this already
Original commit: elastic/x-pack-elasticsearch@f5be371e83
This commit is contained in:
parent
5cd79f20fa
commit
e0b6a1e493
|
@ -23,7 +23,6 @@ import org.elasticsearch.plugins.ActionPlugin;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.rest.RestHandler;
|
import org.elasticsearch.rest.RestHandler;
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
import org.elasticsearch.tasks.TaskManager;
|
|
||||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||||
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
|
@ -202,7 +201,6 @@ public class MlPlugin extends Plugin implements ActionPlugin {
|
||||||
autodetectProcessFactory, normalizerFactory);
|
autodetectProcessFactory, normalizerFactory);
|
||||||
ScheduledJobRunner scheduledJobRunner = new ScheduledJobRunner(threadPool, client, clusterService, jobProvider,
|
ScheduledJobRunner scheduledJobRunner = new ScheduledJobRunner(threadPool, client, clusterService, jobProvider,
|
||||||
System::currentTimeMillis);
|
System::currentTimeMillis);
|
||||||
TaskManager taskManager = new TaskManager(settings);
|
|
||||||
|
|
||||||
JobLifeCycleService jobLifeCycleService =
|
JobLifeCycleService jobLifeCycleService =
|
||||||
new JobLifeCycleService(settings, client, clusterService, dataProcessor, threadPool.generic());
|
new JobLifeCycleService(settings, client, clusterService, dataProcessor, threadPool.generic());
|
||||||
|
@ -227,8 +225,7 @@ public class MlPlugin extends Plugin implements ActionPlugin {
|
||||||
dataProcessor,
|
dataProcessor,
|
||||||
new MlInitializationService(settings, threadPool, clusterService, jobProvider),
|
new MlInitializationService(settings, threadPool, clusterService, jobProvider),
|
||||||
jobDataCountsPersister,
|
jobDataCountsPersister,
|
||||||
scheduledJobRunner,
|
scheduledJobRunner
|
||||||
taskManager
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.tasks.Task;
|
import org.elasticsearch.tasks.Task;
|
||||||
import org.elasticsearch.tasks.TaskId;
|
import org.elasticsearch.tasks.TaskId;
|
||||||
import org.elasticsearch.tasks.TaskManager;
|
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
import org.elasticsearch.xpack.ml.job.Job;
|
import org.elasticsearch.xpack.ml.job.Job;
|
||||||
|
@ -145,17 +144,15 @@ public class DeleteJobAction extends Action<DeleteJobAction.Request, DeleteJobAc
|
||||||
|
|
||||||
private final JobManager jobManager;
|
private final JobManager jobManager;
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final TaskManager taskManager;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
|
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
|
||||||
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, JobManager jobManager,
|
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, JobManager jobManager,
|
||||||
Client client, TaskManager taskManager) {
|
Client client) {
|
||||||
super(settings, DeleteJobAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
super(settings, DeleteJobAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||||
indexNameExpressionResolver, Request::new);
|
indexNameExpressionResolver, Request::new);
|
||||||
this.jobManager = jobManager;
|
this.jobManager = jobManager;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.taskManager = taskManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -170,13 +167,7 @@ public class DeleteJobAction extends Action<DeleteJobAction.Request, DeleteJobAc
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
|
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
|
||||||
jobManager.deleteJob(client, request, ActionListener.wrap(response -> {
|
jobManager.deleteJob(client, request, listener);
|
||||||
taskManager.unregister(task);
|
|
||||||
listener.onResponse(response);
|
|
||||||
}, e -> {
|
|
||||||
taskManager.unregister(task);
|
|
||||||
listener.onFailure(e);
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue