zhtaoxiang commented on code in PR #10083: URL: https://github.com/apache/pinot/pull/10083#discussion_r1065462953
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java: ########## @@ -364,7 +366,46 @@ public synchronized TaskCount getTaskCount(String parentTaskName) { } /** - * Returns a set of Task names (in the form "Task_TestTask_1624403781879") that are in progress or not started yet. + * This method returns a map of table name to count of sub-tasks in various states, given the top-level task name. + * @param parentTaskName in the form "Task_<taskType>_<uuid>_<timestamp>" + * @return a map of table name to {@link TaskCount} + */ + public synchronized Map<String, TaskCount> getTableTaskCount(String parentTaskName) { + Map<String, TaskPartitionState> subtaskStates = getSubtaskStates(parentTaskName); + if (subtaskStates.isEmpty()) { + return Collections.emptyMap(); + } + + JobConfig jobConfig = _taskDriver.getJobConfig(getHelixJobName(parentTaskName)); + // in theory, this should not happen because we have already checked JobContext + if (jobConfig == null) { + return Collections.emptyMap(); + } + + Map<String, TaskCount> tableTaskCountMap = new HashMap<>(); + subtaskStates.forEach((taskId, taskState) -> { + TaskConfig taskConfig = jobConfig.getTaskConfig(taskId); + String tableNameWithType; + // in theory, this should not happen because jobContext has this taskId + if (taskConfig == null) { + tableNameWithType = UNKNOWN_TABLE_NAME; Review Comment: good point! thanks! -- 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