private void buildTaskGroups() { Map<TaskId, TaskGroup.Builder> taskGroups = new HashMap<>(); List<TaskGroup.Builder> topLevelTasks = new ArrayList<>(); // First populate all tasks for (TaskInfo taskInfo : this.tasks) { taskGroups.put(taskInfo.getTaskId(), TaskGroup.builder(taskInfo)); } // Now go through all task group builders and add children to their parents for (TaskGroup.Builder taskGroup : taskGroups.values()) { TaskId parentTaskId = taskGroup.getTaskInfo().getParentTaskId(); if (parentTaskId.isSet()) { TaskGroup.Builder parentTask = taskGroups.get(parentTaskId); if (parentTask != null) { // we found parent in the list of tasks - add it to the parent list parentTask.addGroup(taskGroup); } else { // we got zombie or the parent was filtered out - add it to the top task list topLevelTasks.add(taskGroup); } } else { // top level task - add it to the top task list topLevelTasks.add(taskGroup); } } this.groups = Collections.unmodifiableList(topLevelTasks.stream().map(TaskGroup.Builder::build).collect(Collectors.toList())); }
private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNodes discoveryNodes, TaskInfo taskInfo) { table.startRow(); String nodeId = taskInfo.getTaskId().getNodeId(); DiscoveryNode node = discoveryNodes.get(nodeId); table.addCell(taskInfo.getId()); table.addCell(taskInfo.getAction()); table.addCell(taskInfo.getTaskId().toString()); if (taskInfo.getParentTaskId().isSet()) { table.addCell(taskInfo.getParentTaskId().toString()); } else { table.addCell("-"); } table.addCell(taskInfo.getType()); table.addCell(taskInfo.getStartTime()); table.addCell(FORMATTER.format(Instant.ofEpochMilli(taskInfo.getStartTime()))); table.addCell(taskInfo.getRunningTimeNanos()); table.addCell(TimeValue.timeValueNanos(taskInfo.getRunningTimeNanos()).toString()); // Node information. Note that the node may be null because it has left the cluster between when we got this response and now. table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4)); table.addCell(node == null ? "-" : node.getHostAddress()); table.addCell(node.getAddress().address().getPort()); table.addCell(node == null ? "-" : node.getName()); table.addCell(node == null ? "-" : node.getVersion().toString()); if (detailed) { table.addCell(taskInfo.getDescription()); } table.endRow(); }
private void buildTaskGroups() { Map<TaskId, TaskGroup.Builder> taskGroups = new HashMap<>(); List<TaskGroup.Builder> topLevelTasks = new ArrayList<>(); // First populate all tasks for (TaskInfo taskInfo : this.tasks) { taskGroups.put(taskInfo.getTaskId(), TaskGroup.builder(taskInfo)); } // Now go through all task group builders and add children to their parents for (TaskGroup.Builder taskGroup : taskGroups.values()) { TaskId parentTaskId = taskGroup.getTaskInfo().getParentTaskId(); if (parentTaskId.isSet()) { TaskGroup.Builder parentTask = taskGroups.get(parentTaskId); if (parentTask != null) { // we found parent in the list of tasks - add it to the parent list parentTask.addGroup(taskGroup); } else { // we got zombie or the parent was filtered out - add it to the top task list topLevelTasks.add(taskGroup); } } else { // top level task - add it to the top task list topLevelTasks.add(taskGroup); } } this.groups = Collections.unmodifiableList(topLevelTasks.stream().map(TaskGroup.Builder::build).collect(Collectors.toList())); }
private void buildTaskGroups() { Map<TaskId, TaskGroup.Builder> taskGroups = new HashMap<>(); List<TaskGroup.Builder> topLevelTasks = new ArrayList<>(); // First populate all tasks for (TaskInfo taskInfo : this.tasks) { taskGroups.put(taskInfo.getTaskId(), TaskGroup.builder(taskInfo)); } // Now go through all task group builders and add children to their parents for (TaskGroup.Builder taskGroup : taskGroups.values()) { TaskId parentTaskId = taskGroup.getTaskInfo().getParentTaskId(); if (parentTaskId.isSet()) { TaskGroup.Builder parentTask = taskGroups.get(parentTaskId); if (parentTask != null) { // we found parent in the list of tasks - add it to the parent list parentTask.addGroup(taskGroup); } else { // we got zombie or the parent was filtered out - add it to the the top task list topLevelTasks.add(taskGroup); } } else { // top level task - add it to the top task list topLevelTasks.add(taskGroup); } } this.groups = Collections.unmodifiableList(topLevelTasks.stream().map(TaskGroup.Builder::build).collect(Collectors.toList())); }
private void buildTaskGroups() { Map<TaskId, TaskGroup.Builder> taskGroups = new HashMap<>(); List<TaskGroup.Builder> topLevelTasks = new ArrayList<>(); // First populate all tasks for (TaskInfo taskInfo : this.tasks) { taskGroups.put(taskInfo.getTaskId(), TaskGroup.builder(taskInfo)); } // Now go through all task group builders and add children to their parents for (TaskGroup.Builder taskGroup : taskGroups.values()) { TaskId parentTaskId = taskGroup.getTaskInfo().getParentTaskId(); if (parentTaskId.isSet()) { TaskGroup.Builder parentTask = taskGroups.get(parentTaskId); if (parentTask != null) { // we found parent in the list of tasks - add it to the parent list parentTask.addGroup(taskGroup); } else { // we got zombie or the parent was filtered out - add it to the top task list topLevelTasks.add(taskGroup); } } else { // top level task - add it to the top task list topLevelTasks.add(taskGroup); } } this.groups = Collections.unmodifiableList(topLevelTasks.stream().map(TaskGroup.Builder::build).collect(Collectors.toList())); }
private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNodes discoveryNodes, TaskInfo taskInfo) { table.startRow(); String nodeId = taskInfo.getTaskId().getNodeId(); DiscoveryNode node = discoveryNodes.get(nodeId); table.addCell(taskInfo.getId()); table.addCell(taskInfo.getAction()); table.addCell(taskInfo.getTaskId().toString()); if (taskInfo.getParentTaskId().isSet()) { table.addCell(taskInfo.getParentTaskId().toString()); } else { table.addCell("-"); } table.addCell(taskInfo.getType()); table.addCell(taskInfo.getStartTime()); table.addCell(FORMATTER.format(Instant.ofEpochMilli(taskInfo.getStartTime()))); table.addCell(taskInfo.getRunningTimeNanos()); table.addCell(TimeValue.timeValueNanos(taskInfo.getRunningTimeNanos()).toString()); // Node information. Note that the node may be null because it has left the cluster between when we got this response and now. table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4)); table.addCell(node == null ? "-" : node.getHostAddress()); table.addCell(node.getAddress().address().getPort()); table.addCell(node == null ? "-" : node.getName()); table.addCell(node == null ? "-" : node.getVersion().toString()); if (detailed) { table.addCell(taskInfo.getDescription()); } table.endRow(); }
table.addCell(taskInfo.getAction()); table.addCell(taskInfo.getTaskId().toString()); if (taskInfo.getParentTaskId().isSet()) { table.addCell(taskInfo.getParentTaskId().toString()); } else { table.addCell("-");
private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNodes discoveryNodes, TaskInfo taskInfo) { table.startRow(); String nodeId = taskInfo.getTaskId().getNodeId(); DiscoveryNode node = discoveryNodes.get(nodeId); table.addCell(taskInfo.getId()); table.addCell(taskInfo.getAction()); table.addCell(taskInfo.getTaskId().toString()); if (taskInfo.getParentTaskId().isSet()) { table.addCell(taskInfo.getParentTaskId().toString()); } else { table.addCell("-"); } table.addCell(taskInfo.getType()); table.addCell(taskInfo.getStartTime()); table.addCell(dateFormat.print(taskInfo.getStartTime())); table.addCell(taskInfo.getRunningTimeNanos()); table.addCell(TimeValue.timeValueNanos(taskInfo.getRunningTimeNanos()).toString()); // Node information. Note that the node may be null because it has left the cluster between when we got this response and now. table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4)); table.addCell(node == null ? "-" : node.getHostAddress()); table.addCell(node.getAddress().address().getPort()); table.addCell(node == null ? "-" : node.getName()); table.addCell(node == null ? "-" : node.getVersion().toString()); if (detailed) { table.addCell(taskInfo.getDescription()); } table.endRow(); }