removed redundant private method
Original commit: elastic/x-pack-elasticsearch@dbc377d6b4
This commit is contained in:
parent
d15933ac32
commit
3581fc9d91
|
@ -14,7 +14,6 @@ import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.xpack.prelert.action.UpdateJobStatusAction;
|
import org.elasticsearch.xpack.prelert.action.UpdateJobStatusAction;
|
||||||
import org.elasticsearch.xpack.prelert.job.Job;
|
|
||||||
import org.elasticsearch.xpack.prelert.job.JobStatus;
|
import org.elasticsearch.xpack.prelert.job.JobStatus;
|
||||||
import org.elasticsearch.xpack.prelert.job.data.DataProcessor;
|
import org.elasticsearch.xpack.prelert.job.data.DataProcessor;
|
||||||
|
|
||||||
|
@ -53,7 +52,11 @@ public class JobLifeCycleService extends AbstractComponent implements ClusterSta
|
||||||
DiscoveryNode localNode = event.state().nodes().getLocalNode();
|
DiscoveryNode localNode = event.state().nodes().getLocalNode();
|
||||||
for (Allocation allocation : prelertMetadata.getAllocations().values()) {
|
for (Allocation allocation : prelertMetadata.getAllocations().values()) {
|
||||||
if (localNode.getId().equals(allocation.getNodeId())) {
|
if (localNode.getId().equals(allocation.getNodeId())) {
|
||||||
handleLocallyAllocatedJob(prelertMetadata, allocation);
|
if (localAssignedJobs.contains(allocation.getJobId()) == false) {
|
||||||
|
if (allocation.getStatus() == JobStatus.OPENING) {
|
||||||
|
startJob(allocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,15 +72,6 @@ public class JobLifeCycleService extends AbstractComponent implements ClusterSta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLocallyAllocatedJob(PrelertMetadata prelertMetadata, Allocation allocation) {
|
|
||||||
Job job = prelertMetadata.getJobs().get(allocation.getJobId());
|
|
||||||
if (localAssignedJobs.contains(allocation.getJobId()) == false) {
|
|
||||||
if (allocation.getStatus() == JobStatus.OPENING) {
|
|
||||||
startJob(allocation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void startJob(Allocation allocation) {
|
void startJob(Allocation allocation) {
|
||||||
logger.info("Starting job [" + allocation.getJobId() + "]");
|
logger.info("Starting job [" + allocation.getJobId() + "]");
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
|
|
Loading…
Reference in New Issue