[ML] use correct id

Original commit: elastic/x-pack-elasticsearch@2801ef9f35
This commit is contained in:
Martijn van Groningen 2017-04-12 20:32:02 +02:00
parent 647c3aef53
commit 5461c87345
2 changed files with 4 additions and 3 deletions

View File

@ -46,6 +46,7 @@ import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats;
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData;
import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData.PersistentTask;
import java.io.IOException; import java.io.IOException;
import java.time.Duration; import java.time.Duration;
@ -414,7 +415,7 @@ public class GetJobsStatsAction extends Action<GetJobsStatsAction.Request, GetJo
PersistentTasksCustomMetaData tasks = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); PersistentTasksCustomMetaData tasks = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
Optional<Tuple<DataCounts, ModelSizeStats>> stats = processManager.getStatistics(jobId); Optional<Tuple<DataCounts, ModelSizeStats>> stats = processManager.getStatistics(jobId);
if (stats.isPresent()) { if (stats.isPresent()) {
PersistentTasksCustomMetaData.PersistentTask<?> pTask = MlMetadata.getJobTask(jobId, tasks); PersistentTask<?> pTask = MlMetadata.getJobTask(jobId, tasks);
DiscoveryNode node = state.nodes().get(pTask.getExecutorNode()); DiscoveryNode node = state.nodes().get(pTask.getExecutorNode());
JobState jobState = MlMetadata.getJobState(jobId, tasks); JobState jobState = MlMetadata.getJobState(jobId, tasks);
String assignmentExplanation = pTask.getAssignment().getExplanation(); String assignmentExplanation = pTask.getAssignment().getExplanation();
@ -445,7 +446,7 @@ public class GetJobsStatsAction extends Action<GetJobsStatsAction.Request, GetJo
int slot = i; int slot = i;
String jobId = jobIds.get(i); String jobId = jobIds.get(i);
gatherDataCountsAndModelSizeStats(jobId, (dataCounts, modelSizeStats) -> { gatherDataCountsAndModelSizeStats(jobId, (dataCounts, modelSizeStats) -> {
JobState jobState = MlMetadata.getJobState(request.jobId, tasks); JobState jobState = MlMetadata.getJobState(jobId, tasks);
PersistentTasksCustomMetaData.PersistentTask<?> pTask = MlMetadata.getJobTask(jobId, tasks); PersistentTasksCustomMetaData.PersistentTask<?> pTask = MlMetadata.getJobTask(jobId, tasks);
String assignmentExplanation = null; String assignmentExplanation = null;
if (pTask != null) { if (pTask != null) {

View File

@ -96,7 +96,7 @@ public class TooManyJobsIT extends BaseMlIntegTestCase {
closeRequest.setCloseTimeout(TimeValue.timeValueSeconds(20L)); closeRequest.setCloseTimeout(TimeValue.timeValueSeconds(20L));
CloseJobAction.Response closeResponse = client().execute(CloseJobAction.INSTANCE, closeRequest).actionGet(); CloseJobAction.Response closeResponse = client().execute(CloseJobAction.INSTANCE, closeRequest).actionGet();
assertTrue(closeResponse.isClosed()); assertTrue(closeResponse.isClosed());
client().execute(OpenJobAction.INSTANCE, openJobRequest).get(); client().execute(OpenJobAction.INSTANCE, openJobRequest).actionGet();
assertBusy(() -> { assertBusy(() -> {
for (Client client : clients()) { for (Client client : clients()) {
GetJobsStatsAction.Response statsResponse = GetJobsStatsAction.Response statsResponse =