/** * Build the status for this task given a snapshot of the information of running slices. This is only supported if the task is * set as a leader for slice subtasks */ public TaskInfo taskInfoGivenSubtaskInfo(String localNodeId, List<TaskInfo> sliceInfo) { if (isLeader() == false) { throw new IllegalStateException("This task is not set to be a leader of other slice subtasks"); } List<BulkByScrollTask.StatusOrException> sliceStatuses = Arrays.asList( new BulkByScrollTask.StatusOrException[leaderState.getSlices()]); for (TaskInfo t : sliceInfo) { BulkByScrollTask.Status status = (BulkByScrollTask.Status) t.getStatus(); sliceStatuses.set(status.getSliceId(), new BulkByScrollTask.StatusOrException(status)); } Status status = leaderState.getStatus(sliceStatuses); return taskInfo(localNodeId, getDescription(), status); }
/** * Build the status for this task given a snapshot of the information of running slices. This is only supported if the task is * set as a leader for slice subtasks */ public TaskInfo taskInfoGivenSubtaskInfo(String localNodeId, List<TaskInfo> sliceInfo) { if (isLeader() == false) { throw new IllegalStateException("This task is not set to be a leader of other slice subtasks"); } List<BulkByScrollTask.StatusOrException> sliceStatuses = Arrays.asList( new BulkByScrollTask.StatusOrException[leaderState.getSlices()]); for (TaskInfo t : sliceInfo) { BulkByScrollTask.Status status = (BulkByScrollTask.Status) t.getStatus(); sliceStatuses.set(status.getSliceId(), new BulkByScrollTask.StatusOrException(status)); } Status status = leaderState.getStatus(sliceStatuses); return taskInfo(localNodeId, getDescription(), status); }
@Override public TaskInfo getInfoGivenSliceInfo(String localNodeId, List<TaskInfo> sliceInfo) { /* Merge the list of finished sub requests with the provided info. If a slice is both finished and in the list then we prefer the * finished status because we don't expect them to change after the task is finished. */ List<StatusOrException> sliceStatuses = Arrays.asList(new StatusOrException[results.length()]); for (TaskInfo t : sliceInfo) { Status status = (Status) t.getStatus(); sliceStatuses.set(status.getSliceId(), new StatusOrException(status)); } addResultsToList(sliceStatuses); Status status = new Status(sliceStatuses, getReasonCancelled()); return taskInfo(localNodeId, getDescription(), status); }