ramabme commented on a change in pull request #7300: URL: https://github.com/apache/pinot/pull/7300#discussion_r690799347
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java ########## @@ -427,29 +498,161 @@ private static String getTaskType(String name) { return name.split(TASK_NAME_SEPARATOR)[1]; } - public static class TaskCount { - private int _waiting; // Number of tasks waiting to be scheduled on minions - private int _error; // Number of tasks in error - private int _running; // Number of tasks currently running in minions - private int _total; // Total number of tasks in the batch + @JsonPropertyOrder({"taskState", "subTaskCount", "startTime", "executionStartTime", "subTaskInfos"}) + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class TaskDebugInfo { + private String _startTime; + private String _executionStartTime; + private TaskState _taskState; + private TaskCount _subTaskCount; + private List<TaskPartitionDebugInfo> _subTaskInfos; - public TaskCount() { + public TaskDebugInfo() { + } + + public void setStartTime(String startTime) { + _startTime = startTime; + } + + public void setExecutionStartTime(String executionStartTime) { + _executionStartTime = executionStartTime; + } + + public void setTaskState(TaskState taskState) { + _taskState = taskState; + } + + public void setSubTaskCount(TaskCount subTaskCount) { + _subTaskCount = subTaskCount; + } + + public void addSubTaskInfo(TaskPartitionDebugInfo subTaskInfo) { + if (_subTaskInfos == null) { + _subTaskInfos = new ArrayList<>(); + } + _subTaskInfos.add(subTaskInfo); + } + + public String getStartTime() { + return _startTime; + } + + public String getExecutionStartTime() { + return _executionStartTime; + } + + public TaskState getTaskState() { + return _taskState; } - public void addToWaiting(int waiting) { - _waiting += waiting; + public TaskCount getSubTaskCount() { + return _subTaskCount; } - public void addToRunning(int running) { - _running += running; + public List<TaskPartitionDebugInfo> getSubTaskInfos() { + return _subTaskInfos; + } + } + + @JsonPropertyOrder({"taskId", "state", "startTime", "finishTime", "participant", "info", "taskConfig"}) + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class TaskPartitionDebugInfo { + private String _taskId; + private TaskPartitionState _state; + private String _startTime; + private String _finishTime; + private String _participant; + private String _info; + private PinotTaskConfig _taskConfig; + + public TaskPartitionDebugInfo() { + } + + public void setTaskId(String taskId) { + _taskId = taskId; + } + + public void setState(TaskPartitionState state) { + _state = state; + } + + public void setStartTime(String startTime) { + _startTime = startTime; + } + + public void setFinishTime(String finishTime) { + _finishTime = finishTime; + } + + public void setParticipant(String participant) { + _participant = participant; + } + + public void setInfo(String info) { + _info = info; + } + + public void setTaskConfig(PinotTaskConfig taskConfig) { + _taskConfig = taskConfig; + } + + public String getTaskId() { + return _taskId; + } + + public TaskPartitionState getState() { + return _state; + } + + public String getStartTime() { + return _startTime; + } + + public String getFinishTime() { + return _finishTime; } - public void addToTotal(int total) { - _total += total; + public String getParticipant() { + return _participant; } - public void addToError(int error) { - _error += error; + public String getInfo() { + return _info; + } + + public PinotTaskConfig getTaskConfig() { + return _taskConfig; + } + } + + @JsonPropertyOrder({"total", "completed", "running", "waiting", "error", "unknown"}) + public static class TaskCount { + private int _waiting; // Number of tasks waiting to be scheduled on minions + private int _error; // Number of tasks in error + private int _running; // Number of tasks currently running in minions + private int _completed; // Number of tasks completed normally + private int _unknown; // Number of tasks with all other states + private int _total; // Total number of tasks in the batch + + public TaskCount() { + } + + /* Update count based on state for each task running under a HelixJob/PinotTask */ + public void addTaskState(TaskPartitionState state) { + _total++; + // Helix returns state as null if the task is not enqueued anywhere yet + if (state == null) { + // task is not yet assigned to a participant + _waiting++; + } else if (state.equals(TaskPartitionState.INIT) || state.equals(TaskPartitionState.RUNNING)) { Review comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org