ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688943455
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -381,6 +377,74 @@ public synchronized TaskState getTaskState(String
taskName) {
return filteredTaskStateMap;
}
+ /**
+ * Given a taskType, helper method to debug all the HelixJobs for the
taskType.
+ * For each of the HelixJobs, collects status of the (sub)tasks in the
taskbatch.
+ *
+ * @param taskType Pinot taskType / Helix JobQueue
+ * @param verboseLevel By default, does not show details for completed
tasks.
+ * If verboseLevel >= 10, shows details for all tasks.
+ * @return Map of Pinot Task Name to TaskDebugInfo. TaskDebugInfo contains
details for subtasks.
+ */
+ public synchronized Map<String, TaskDebugInfo> getTaskDebugInfo(String
taskType, int verboseLevel) {
+ Map<String, TaskDebugInfo> taskDebugInfos = new HashMap<>();
+ WorkflowContext workflowContext =
_taskDriver.getWorkflowContext(getHelixJobQueueName(taskType));
+ if (workflowContext == null) {
+ return taskDebugInfos;
+ }
+ boolean showCompleted = verboseLevel >= 10;
+ long timeMillis;
+ SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss z", Locale.getDefault());
+ SIMPLE_DATE_FORMAT.setTimeZone(TimeZone.getDefault());
+ Map<String, TaskState> helixJobStates = workflowContext.getJobStates();
+ for (String helixJobName : helixJobStates.keySet()) {
+ String pinotTaskName = getPinotTaskName(helixJobName);
+ TaskDebugInfo taskDebugInfo = new TaskDebugInfo();
+ taskDebugInfo.setTaskState(workflowContext.getJobState(helixJobName));
+ timeMillis = workflowContext.getJobStartTime(helixJobName);
+ taskDebugInfo.setStartTime((timeMillis <= 0) ? null :
SIMPLE_DATE_FORMAT.format(timeMillis));
+ JobContext jobContext = _taskDriver.getJobContext(helixJobName);
+ if (jobContext != null) {
+ JobConfig jobConfig = _taskDriver.getJobConfig(helixJobName);
+ timeMillis = jobContext.getExecutionStartTime();
+ taskDebugInfo.setExecutionStartTime((timeMillis <= 0) ? null :
SIMPLE_DATE_FORMAT.format(timeMillis));
+ Set<Integer> partitionSet = jobContext.getPartitionSet();
+ TaskCount subTaskCount = new TaskCount();
+ subTaskCount.addToTotal(partitionSet.size());
+ for (int partition : partitionSet) {
Review comment:
The enum for the keys of the mapField is private to the JobContext
class.
```
private enum ContextProperties {
START_TIME, // Time at which this JobContext was created
STATE,
.......
.......
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]