You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/08/13 18:27:10 UTC

[GitHub] [pinot] ramabme opened a new pull request #7300: Add debug endpoint to get minion task status.

ramabme opened a new pull request #7300:
URL: https://github.com/apache/pinot/pull/7300


   ## Description
   Given a taskType, fetches information for all the HelixJobs for the taskType.
   For each of the HelixJobs, collects status of the (sub)tasks in the taskbatch.
   
   
   ## Upgrade Notes
   Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)
   * [ ] Yes (Please label as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR fix a zero-downtime upgrade introduced earlier?
   * [ ] Yes (Please label this as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR otherwise need attention when creating release notes? Things to consider:
   - New configuration options
   - Deprecation of configurations
   - Signature changes to public methods/interfaces
   - New plugins added or old plugins removed
   * [ ] Yes (Please label this PR as **<code>release-notes</code>** and complete the section on Release Notes)
   ## Release Notes
   <!-- If you have tagged this as either backward-incompat or release-notes,
   you MUST add text here that you would like to see appear in release notes of the
   next release. -->
   
   <!-- If you have a series of commits adding or enabling a feature, then
   add this section only in final commit that marks the feature completed.
   Refer to earlier release notes to see examples of text.
   -->
   ## Documentation
   <!-- If you have introduced a new feature or configuration, please add it to the documentation as well.
   See https://docs.pinot.apache.org/developers/developers-and-contributors/update-document
   -->
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688958971



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -452,6 +640,25 @@ public void addToError(int error) {
       _error += error;
     }
 
+    public void addToCompleted(int completed) {

Review comment:
       removed the addTo* and only setter is addTaskState.




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang merged pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang merged pull request #7300:
URL: https://github.com/apache/pinot/pull/7300


   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] codecov-commenter edited a comment on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898663047


   # [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#7300](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6d4da24) into [master](https://codecov.io/gh/apache/pinot/commit/d0b8d88ec7833e367393bab71772a2d730738416?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d0b8d88) will **decrease** coverage by `2.46%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head 6d4da24 differs from pull request most recent head d9187fd. Consider uploading reports for the commit d9187fd to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7300/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7300      +/-   ##
   ============================================
   - Coverage     71.43%   68.97%   -2.47%     
   + Complexity     3280     3194      -86     
   ============================================
     Files          1504     1110     -394     
     Lines         74063    52186   -21877     
     Branches      10726     7803    -2923     
   ============================================
   - Hits          52908    35994   -16914     
   + Misses        17554    13609    -3945     
   + Partials       3601     2583    -1018     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration1 | `?` | |
   | integration2 | `?` | |
   | unittests1 | `68.97% <ø> (+0.02%)` | :arrow_up: |
   | unittests2 | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...a/org/apache/pinot/common/metrics/MinionMeter.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25NZXRlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...g/apache/pinot/common/metrics/ControllerMeter.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Db250cm9sbGVyTWV0ZXIuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/BrokerQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Ccm9rZXJRdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/MinionQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25RdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...pache/pinot/common/utils/grpc/GrpcQueryClient.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvZ3JwYy9HcnBjUXVlcnlDbGllbnQuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...he/pinot/common/messages/SegmentReloadMessage.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWVzc2FnZXMvU2VnbWVudFJlbG9hZE1lc3NhZ2UuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...t/core/startree/plan/StarTreeDocIdSetPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlRG9jSWRTZXRQbGFuTm9kZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ot/common/restlet/resources/TableMetadataInfo.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vcmVzdGxldC9yZXNvdXJjZXMvVGFibGVNZXRhZGF0YUluZm8uamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../core/startree/plan/StarTreeTransformPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlVHJhbnNmb3JtUGxhbk5vZGUuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...core/startree/plan/StarTreeProjectionPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlUHJvamVjdGlvblBsYW5Ob2RlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [592 more](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d0b8d88...d9187fd](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688957805



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -452,6 +640,25 @@ public void addToError(int error) {
       _error += error;
     }
 
+    public void addToCompleted(int completed) {
+      _completed += completed;
+    }
+
+    /* Update count based on state for each task running under a HelixJob/PinotTask */
+    public void addTaskState(TaskPartitionState state) {
+      // Helix returns state as null if the task is not enqueued anywhere yet
+      if (state == null) {
+        // task is not yet assigned to a participant
+        addToWaiting(1);
+      } else if (state.equals(TaskPartitionState.INIT) || state.equals(TaskPartitionState.RUNNING)) {
+        addToRunning(1);
+      } else if (state.equals(TaskPartitionState.TASK_ERROR)) {
+        addToError(1);
+      } else if (state.equals(TaskPartitionState.COMPLETED)) {
+        addToCompleted(1);
+      }

Review comment:
       added




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] codecov-commenter commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898663047


   # [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#7300](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4c0920c) into [master](https://codecov.io/gh/apache/pinot/commit/fca88a20e98edf363e9721bf43e0487e9aafd7b6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fca88a2) will **decrease** coverage by `2.32%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head 4c0920c differs from pull request most recent head b0a2a28. Consider uploading reports for the commit b0a2a28 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7300/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7300      +/-   ##
   ============================================
   - Coverage     71.31%   68.98%   -2.33%     
   + Complexity     3361     3181     -180     
   ============================================
     Files          1503     1109     -394     
     Lines         73995    52137   -21858     
     Branches      10709     7790    -2919     
   ============================================
   - Hits          52766    35967   -16799     
   + Misses        17627    13590    -4037     
   + Partials       3602     2580    -1022     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration1 | `?` | |
   | integration2 | `?` | |
   | unittests1 | `68.98% <ø> (-0.03%)` | :arrow_down: |
   | unittests2 | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...a/org/apache/pinot/common/metrics/MinionMeter.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25NZXRlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...g/apache/pinot/common/metrics/ControllerMeter.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Db250cm9sbGVyTWV0ZXIuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/BrokerQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Ccm9rZXJRdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/MinionQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25RdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...pache/pinot/common/utils/grpc/GrpcQueryClient.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvZ3JwYy9HcnBjUXVlcnlDbGllbnQuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...he/pinot/common/messages/SegmentReloadMessage.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWVzc2FnZXMvU2VnbWVudFJlbG9hZE1lc3NhZ2UuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...not/common/exception/HttpErrorStatusException.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vZXhjZXB0aW9uL0h0dHBFcnJvclN0YXR1c0V4Y2VwdGlvbi5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...t/core/startree/plan/StarTreeDocIdSetPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlRG9jSWRTZXRQbGFuTm9kZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ot/common/restlet/resources/TableMetadataInfo.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vcmVzdGxldC9yZXNvdXJjZXMvVGFibGVNZXRhZGF0YUluZm8uamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../core/startree/plan/StarTreeTransformPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlVHJhbnNmb3JtUGxhbk5vZGUuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [586 more](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [fca88a2...b0a2a28](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-901322490


   > Why do we call this debug endpoint? Getting state of a task should be a first class api rt
   
   I guess the original motivation was to get information/errors/msgs from Helix to debug failing or long pending tasks. And to figure out and show selective but sufficient information for the tasks of a taskType and for each task(batch) information about subtasks. Jackie/Mayank can correct me.
    
   There is an existing API that only gives the state(single value) about the Task(batch) but no details . 


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688959200



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -427,10 +491,134 @@ private static String getTaskType(String name) {
     return name.split(TASK_NAME_SEPARATOR)[1];
   }
 
+  public static class TaskDebugInfo {
+    private String _startTime = null;
+    private String _executionStartTime = null;
+    private TaskState _taskState = null;
+    private TaskCount _subTaskCounts = null;
+    private List<TaskPartitionDebugInfo> _subTaskInfos = null;
+
+    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) {
+      _subTaskCounts = 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 TaskCount getSubTaskCount() {
+      return _subTaskCounts;
+    }
+
+    public List<TaskPartitionDebugInfo> getSubTaskInfos() {
+      return _subTaskInfos;
+    }
+  }
+
+  public static class TaskPartitionDebugInfo {
+    private String _taskId = null;
+    private TaskPartitionState _state = null;
+    private String _startTime = null;
+    private String _finishTime = null;
+    private String _participant = null;
+    private String _info = null;
+    private PinotTaskConfig _taskConfig = null;
+
+    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 String getParticipant() {
+      return _participant;
+    }
+
+    public String getInfo() {
+      return _info;
+    }
+
+    public PinotTaskConfig getTaskConfig() {
+      return _taskConfig;
+    }
+  }
+
   public static class TaskCount {

Review comment:
       done

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -427,10 +491,134 @@ private static String getTaskType(String name) {
     return name.split(TASK_NAME_SEPARATOR)[1];
   }
 
+  public static class TaskDebugInfo {

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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r690800073



##########
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 {

Review comment:
       Renamed TaskPartitionDebugInfo to SubtaskDebugInfo




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] codecov-commenter edited a comment on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898663047


   # [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#7300](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4c0920c) into [master](https://codecov.io/gh/apache/pinot/commit/fca88a20e98edf363e9721bf43e0487e9aafd7b6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fca88a2) will **decrease** coverage by `1.31%`.
   > The diff coverage is `0.00%`.
   
   > :exclamation: Current head 4c0920c differs from pull request most recent head b0a2a28. Consider uploading reports for the commit b0a2a28 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7300/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7300      +/-   ##
   ============================================
   - Coverage     71.31%   69.99%   -1.32%     
   + Complexity     3361     3273      -88     
   ============================================
     Files          1503     1503              
     Lines         73995    74106     +111     
     Branches      10709    10723      +14     
   ============================================
   - Hits          52766    51869     -897     
   - Misses        17627    18653    +1026     
   + Partials       3602     3584      -18     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration1 | `?` | |
   | integration2 | `29.25% <0.00%> (-0.04%)` | :arrow_down: |
   | unittests1 | `68.98% <ø> (-0.03%)` | :arrow_down: |
   | unittests2 | `14.62% <0.00%> (-0.03%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...roller/api/resources/PinotTaskRestletResource.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9hcGkvcmVzb3VyY2VzL1Bpbm90VGFza1Jlc3RsZXRSZXNvdXJjZS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...lix/core/minion/PinotHelixTaskResourceManager.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9oZWxpeC9jb3JlL21pbmlvbi9QaW5vdEhlbGl4VGFza1Jlc291cmNlTWFuYWdlci5qYXZh) | `20.38% <0.00%> (-51.62%)` | :arrow_down: |
   | [...pinot/minion/exception/TaskCancelledException.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtbWluaW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9taW5pb24vZXhjZXB0aW9uL1Rhc2tDYW5jZWxsZWRFeGNlcHRpb24uamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...not/common/exception/HttpErrorStatusException.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vZXhjZXB0aW9uL0h0dHBFcnJvclN0YXR1c0V4Y2VwdGlvbi5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...rt\_to\_raw\_index/ConvertToRawIndexTaskExecutor.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3MvY29udmVydF90b19yYXdfaW5kZXgvQ29udmVydFRvUmF3SW5kZXhUYXNrRXhlY3V0b3IuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ore/startree/executor/StarTreeGroupByExecutor.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9leGVjdXRvci9TdGFyVHJlZUdyb3VwQnlFeGVjdXRvci5qYXZh) | `0.00% <0.00%> (-86.67%)` | :arrow_down: |
   | [.../transform/function/MapValueTransformFunction.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9vcGVyYXRvci90cmFuc2Zvcm0vZnVuY3Rpb24vTWFwVmFsdWVUcmFuc2Zvcm1GdW5jdGlvbi5qYXZh) | `0.00% <0.00%> (-85.30%)` | :arrow_down: |
   | [...plugin/segmentuploader/SegmentUploaderDefault.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtcGx1Z2lucy9waW5vdC1zZWdtZW50LXVwbG9hZGVyL3Bpbm90LXNlZ21lbnQtdXBsb2FkZXItZGVmYXVsdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvcGx1Z2luL3NlZ21lbnR1cGxvYWRlci9TZWdtZW50VXBsb2FkZXJEZWZhdWx0LmphdmE=) | `0.00% <0.00%> (-85.19%)` | :arrow_down: |
   | [...t\_to\_raw\_index/ConvertToRawIndexTaskGenerator.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3MvY29udmVydF90b19yYXdfaW5kZXgvQ29udmVydFRvUmF3SW5kZXhUYXNrR2VuZXJhdG9yLmphdmE=) | `10.41% <0.00%> (-77.09%)` | :arrow_down: |
   | [...che/pinot/core/util/SegmentProcessorAvroUtils.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS91dGlsL1NlZ21lbnRQcm9jZXNzb3JBdnJvVXRpbHMuamF2YQ==) | `0.00% <0.00%> (-74.42%)` | :arrow_down: |
   | ... and [86 more](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [fca88a2...b0a2a28](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme edited a comment on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme edited a comment on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898649318


   Add an initial implementation of debug endpoint to get information about the minion PinotTasks queued and information about the subtasks running under each PinotTask batch. 
   The endpoint has a verbositylevel. By default we print only high level summary for completed tasks. For incomplete subtasks prints more detail. If verbositylevel is set to >=10 , prints for all tasks.
   
   An example output with default verbosity - the first and the third PinotTask are completed tasks with only high level info ,
   ```
   {
     "Task_RealtimeToOfflineSegmentsTask_1628833546894": {
       "subTaskInfos": null,
       "subTaskCount": {
         "waiting": 0,
         "error": 0,
         "total": 1,
         "running": 0,
         "completed": 1
       },
       "startTime": "2021-08-12 22:46:12 PDT",
       "taskState": "COMPLETED",
       "executionStartTime": "2021-08-12 22:46:12 PDT"
     },
     "Task_RealtimeToOfflineSegmentsTask_1628833651118": {
       "subTaskInfos": [
         {
           "startTime": "2021-08-12 22:47:57 PDT",
           "info": "",
           "taskConfig": {
             "configs": {
               "uploadURL": "http://localhost:18998/segments",
               "downloadURL": "http://localhost:18998/segments/mytable/mytable__0__5__20210813T0544Z,http://localhost:18998/segments/mytable/mytable__1__5__20210813T0544Z",
               "windowStartMs": "1388707200000",
               "segmentName": "mytable__0__5__20210813T0544Z,mytable__1__5__20210813T0544Z",
               "windowEndMs": "1388793600000",
               "tableName": "mytable_REALTIME"
             },
             "taskType": "RealtimeToOfflineSegmentsTask"
           },
           "state": "RUNNING",
           "participant": "Minion_192.168.1.21_9514",
           "finishTime": null,
           "taskId": "Task_RealtimeToOfflineSegmentsTask_1628833651118_0"
         }
       ],
       "subTaskCount": {
         "waiting": 0,
         "error": 0,
         "total": 1,
         "running": 1,
         "completed": 0
       },
       "startTime": "2021-08-12 22:47:57 PDT",
       "taskState": "IN_PROGRESS",
       "executionStartTime": "2021-08-12 22:47:57 PDT"
     },
     "Task_RealtimeToOfflineSegmentsTask_1628833502672": {
       "subTaskInfos": null,
       "subTaskCount": {
         "waiting": 0,
         "error": 0,
         "total": 1,
         "running": 0,
         "completed": 1
       },
       "startTime": "2021-08-12 22:45:14 PDT",
       "taskState": "COMPLETED",
       "executionStartTime": "2021-08-12 22:45:14 PDT"
     }
   }
   ```


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688757009



##########
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;

Review comment:
       thought we might add other verbose-levels. So made this a high level. 
   If u do not foresee this, will make it > 1.




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688959426



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -427,10 +491,134 @@ private static String getTaskType(String name) {
     return name.split(TASK_NAME_SEPARATOR)[1];
   }
 
+  public static class TaskDebugInfo {
+    private String _startTime = null;
+    private String _executionStartTime = null;
+    private TaskState _taskState = null;
+    private TaskCount _subTaskCounts = null;
+    private List<TaskPartitionDebugInfo> _subTaskInfos = null;
+
+    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) {
+      _subTaskCounts = 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 TaskCount getSubTaskCount() {
+      return _subTaskCounts;
+    }
+
+    public List<TaskPartitionDebugInfo> getSubTaskInfos() {
+      return _subTaskInfos;
+    }
+  }
+
+  public static class TaskPartitionDebugInfo {
+    private String _taskId = null;

Review comment:
       cleaned.




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang merged pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang merged pull request #7300:
URL: https://github.com/apache/pinot/pull/7300


   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] codecov-commenter edited a comment on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898663047


   # [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#7300](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6d4da24) into [master](https://codecov.io/gh/apache/pinot/commit/d0b8d88ec7833e367393bab71772a2d730738416?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d0b8d88) will **decrease** coverage by `2.46%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head 6d4da24 differs from pull request most recent head d9187fd. Consider uploading reports for the commit d9187fd to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/pinot/pull/7300/graphs/tree.svg?width=650&height=150&src=pr&token=4ibza2ugkz&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7300      +/-   ##
   ============================================
   - Coverage     71.43%   68.97%   -2.47%     
   + Complexity     3280     3194      -86     
   ============================================
     Files          1504     1110     -394     
     Lines         74063    52186   -21877     
     Branches      10726     7803    -2923     
   ============================================
   - Hits          52908    35994   -16914     
   + Misses        17554    13609    -3945     
   + Partials       3601     2583    -1018     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration1 | `?` | |
   | integration2 | `?` | |
   | unittests1 | `68.97% <ø> (+0.02%)` | :arrow_up: |
   | unittests2 | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...a/org/apache/pinot/common/metrics/MinionMeter.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25NZXRlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...g/apache/pinot/common/metrics/ControllerMeter.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Db250cm9sbGVyTWV0ZXIuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/BrokerQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9Ccm9rZXJRdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../apache/pinot/common/metrics/MinionQueryPhase.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWV0cmljcy9NaW5pb25RdWVyeVBoYXNlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...pache/pinot/common/utils/grpc/GrpcQueryClient.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvZ3JwYy9HcnBjUXVlcnlDbGllbnQuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...he/pinot/common/messages/SegmentReloadMessage.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vbWVzc2FnZXMvU2VnbWVudFJlbG9hZE1lc3NhZ2UuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...t/core/startree/plan/StarTreeDocIdSetPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlRG9jSWRTZXRQbGFuTm9kZS5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ot/common/restlet/resources/TableMetadataInfo.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vcmVzdGxldC9yZXNvdXJjZXMvVGFibGVNZXRhZGF0YUluZm8uamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../core/startree/plan/StarTreeTransformPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlVHJhbnNmb3JtUGxhbk5vZGUuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...core/startree/plan/StarTreeProjectionPlanNode.java](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29yZS9zdGFydHJlZS9wbGFuL1N0YXJUcmVlUHJvamVjdGlvblBsYW5Ob2RlLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [592 more](https://codecov.io/gh/apache/pinot/pull/7300/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d0b8d88...d9187fd](https://codecov.io/gh/apache/pinot/pull/7300?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-901351402


   @kishoreg
   We plan to provide the following APIs:
   1. Debug info for a given task type to get a global view for all the tasks under this type (in this PR)
   2. Debug info for a given task type and id (single task)
   3. Get the subtask state count for a given task type
   
   Then we can hook them into the cluster manager UI


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r689739117



##########
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:
       (nit) let's use `switch` here

##########
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;

Review comment:
       (nit) I think `subtask` is a word, so name the variable `_subtaskCount` and `_subtaskInfos`? Same for the methods

##########
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 {

Review comment:
       Suggest renaming to `SubtaskDebugInfo` to match the json field name?




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r690799668



##########
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;

Review comment:
       changed subTask/SubTask to subtask/Subtask




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688959650



##########
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;

Review comment:
       cleaned




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688959974



##########
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) {
+          // First get the partition's state and update the subTaskCount
+          TaskPartitionState partitionState = jobContext.getPartitionState(partition);
+          subTaskCount.addTaskState(partitionState);
+          if (!showCompleted) {
+            // Skip details for COMPLETED tasks
+            if (partitionState != null && partitionState.equals(TaskPartitionState.COMPLETED)) {
+              continue;
+            }
+          }

Review comment:
       cleaned




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] kishoreg commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
kishoreg commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-901325728


   > I guess the original motivation was to get information/errors/msgs from Helix to debug failing or long pending tasks. And to figure out and show selective but sufficient information for the tasks of a taskType and for each task(batch) information about subtasks. Jackie/Mayank can correct me.
   > 
   > There is an existing API that only gives the state(single value) about the Task(batch) but no details
   
   What is the expected workflow from user
   -
   
   1. Get all the tasks and then get debug for a specific task id OR
   2. Get all debug info for all tasks
   
   As a developer, I can see the need for 1. Not sure why I would do 2.
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688959582



##########
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()) {

Review comment:
       cleaned




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688735058



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -452,6 +640,25 @@ public void addToError(int error) {
       _error += error;
     }
 
+    public void addToCompleted(int completed) {

Review comment:
       We can remove all these `addTo*` and only allow `addTaskState`

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -427,10 +491,134 @@ private static String getTaskType(String name) {
     return name.split(TASK_NAME_SEPARATOR)[1];
   }
 
+  public static class TaskDebugInfo {
+    private String _startTime = null;
+    private String _executionStartTime = null;
+    private TaskState _taskState = null;
+    private TaskCount _subTaskCounts = null;
+    private List<TaskPartitionDebugInfo> _subTaskInfos = null;
+
+    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) {
+      _subTaskCounts = 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 TaskCount getSubTaskCount() {
+      return _subTaskCounts;
+    }
+
+    public List<TaskPartitionDebugInfo> getSubTaskInfos() {
+      return _subTaskInfos;
+    }
+  }
+
+  public static class TaskPartitionDebugInfo {
+    private String _taskId = null;
+    private TaskPartitionState _state = null;
+    private String _startTime = null;
+    private String _finishTime = null;
+    private String _participant = null;
+    private String _info = null;
+    private PinotTaskConfig _taskConfig = null;
+
+    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 String getParticipant() {
+      return _participant;
+    }
+
+    public String getInfo() {
+      return _info;
+    }
+
+    public PinotTaskConfig getTaskConfig() {
+      return _taskConfig;
+    }
+  }
+
   public static class TaskCount {

Review comment:
       Let's fix the order of these fields by putting a `JsonPropertyOrder` annotation

##########
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;

Review comment:
       (nit) Don't define it here

##########
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:
       (Optional) We can avoid a lot of redundant map lookups by directly accessing the `jobContext.getRecord().getMapFields().entrySet()`. You may read the `JobContext` code to understand how each field is extracted

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -452,6 +640,25 @@ public void addToError(int error) {
       _error += error;
     }
 
+    public void addToCompleted(int completed) {
+      _completed += completed;
+    }
+
+    /* Update count based on state for each task running under a HelixJob/PinotTask */
+    public void addTaskState(TaskPartitionState state) {
+      // Helix returns state as null if the task is not enqueued anywhere yet
+      if (state == null) {
+        // task is not yet assigned to a participant
+        addToWaiting(1);
+      } else if (state.equals(TaskPartitionState.INIT) || state.equals(TaskPartitionState.RUNNING)) {
+        addToRunning(1);
+      } else if (state.equals(TaskPartitionState.TASK_ERROR)) {
+        addToError(1);
+      } else if (state.equals(TaskPartitionState.COMPLETED)) {
+        addToCompleted(1);
+      }

Review comment:
       Let's add a catch all state (e.g. `Unknown`) in case we got other states

##########
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());

Review comment:
       We should make this a util to avoid different class using different format. We can do it in a separate PR

##########
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()) {

Review comment:
       Use `entrySet()` to avoid another lookup to get the job state

##########
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;

Review comment:
       Why do we choose >= 10 instead of > 1?

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java
##########
@@ -131,6 +131,15 @@ public StringResultResponse getTaskQueueStateDeprecated(
     return _pinotHelixTaskResourceManager.getTaskStatesByTable(taskType, tableNameWithType);
   }
 
+  @GET
+  @Path("/tasks/{taskType}/debug")
+  @ApiOperation("Fetch information for all the tasks for the given task type")
+  public Map<String, PinotHelixTaskResourceManager.TaskDebugInfo> getTaskDebugInfo(
+      @ApiParam(value = "Task type", required = true) @PathParam("taskType") String taskType,
+      @ApiParam(value = "verbosity (default prints for running and error tasks. Value of >=10 prints for all tasks)") @DefaultValue("1") @QueryParam("verboseLevel") int verboseLevel) {

Review comment:
       Let's use `verbosity` to be consistent with the segment debug info

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -427,10 +491,134 @@ private static String getTaskType(String name) {
     return name.split(TASK_NAME_SEPARATOR)[1];
   }
 
+  public static class TaskDebugInfo {

Review comment:
       Let's fix the order of these fields by putting a `JsonPropertyOrder` annotation

##########
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) {
+          // First get the partition's state and update the subTaskCount
+          TaskPartitionState partitionState = jobContext.getPartitionState(partition);
+          subTaskCount.addTaskState(partitionState);
+          if (!showCompleted) {
+            // Skip details for COMPLETED tasks
+            if (partitionState != null && partitionState.equals(TaskPartitionState.COMPLETED)) {
+              continue;
+            }
+          }

Review comment:
       ```suggestion
             // Skip details for COMPLETED tasks
             if (!showCompleted && partitionState == TaskPartitionState.COMPLETED) {
               continue;
             }
   ```

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java
##########
@@ -427,10 +491,134 @@ private static String getTaskType(String name) {
     return name.split(TASK_NAME_SEPARATOR)[1];
   }
 
+  public static class TaskDebugInfo {
+    private String _startTime = null;
+    private String _executionStartTime = null;
+    private TaskState _taskState = null;
+    private TaskCount _subTaskCounts = null;
+    private List<TaskPartitionDebugInfo> _subTaskInfos = null;
+
+    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) {
+      _subTaskCounts = 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 TaskCount getSubTaskCount() {
+      return _subTaskCounts;
+    }
+
+    public List<TaskPartitionDebugInfo> getSubTaskInfos() {
+      return _subTaskInfos;
+    }
+  }
+
+  public static class TaskPartitionDebugInfo {
+    private String _taskId = null;

Review comment:
       (nit) no need to explicitly put `= null` for member variables

##########
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<>();

Review comment:
       Use a `TreeMap` so that the entries are ordered by the task name

##########
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));

Review comment:
       (nit) for readability. Same for other time handling
   ```suggestion
         long jobStartTimeMs = workflowContext.getJobStartTime(helixJobName);
         if (jobStartTimeMs > 0) {
           taskDebugInfo.setStartTime(SIMPLE_DATE_FORMAT.format(jobStartTimeMs));
         }
   ```




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898915045


   Cleaned up based on the review.


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] kishoreg commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
kishoreg commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-901258315


   Why do we call this debug endpoint? Getting state of a task should be a first class api rt


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#issuecomment-898649318


   Add an initial implementation of debug endpoint to get information about the minion PinotTasks queued and information about the subtasks running under each PinotTask batch. 
   The endpoint has a verbositylevel. By default we print only high level summary for completed tasks. For incomplete subtasks prints more detail. If verbositylevel is set to >=10 , prints for all tasks.
   
   An example output with default verbosity - the first and the third PinotTask are completed tasks with only high level info ,
   
   {
     "Task_RealtimeToOfflineSegmentsTask_1628833546894": {
       "subTaskInfos": null,
       "subTaskCount": {
         "waiting": 0,
         "error": 0,
         "total": 1,
         "running": 0,
         "completed": 1
       },
       "startTime": "2021-08-12 22:46:12 PDT",
       "taskState": "COMPLETED",
       "executionStartTime": "2021-08-12 22:46:12 PDT"
     },
     "Task_RealtimeToOfflineSegmentsTask_1628833651118": {
       "subTaskInfos": [
         {
           "startTime": "2021-08-12 22:47:57 PDT",
           "info": "",
           "taskConfig": {
             "configs": {
               "uploadURL": "http://localhost:18998/segments",
               "downloadURL": "http://localhost:18998/segments/mytable/mytable__0__5__20210813T0544Z,http://localhost:18998/segments/mytable/mytable__1__5__20210813T0544Z",
               "windowStartMs": "1388707200000",
               "segmentName": "mytable__0__5__20210813T0544Z,mytable__1__5__20210813T0544Z",
               "windowEndMs": "1388793600000",
               "tableName": "mytable_REALTIME"
             },
             "taskType": "RealtimeToOfflineSegmentsTask"
           },
           "state": "RUNNING",
           "participant": "Minion_192.168.1.21_9514",
           "finishTime": null,
           "taskId": "Task_RealtimeToOfflineSegmentsTask_1628833651118_0"
         }
       ],
       "subTaskCount": {
         "waiting": 0,
         "error": 0,
         "total": 1,
         "running": 1,
         "completed": 0
       },
       "startTime": "2021-08-12 22:47:57 PDT",
       "taskState": "IN_PROGRESS",
       "executionStartTime": "2021-08-12 22:47:57 PDT"
     },
     "Task_RealtimeToOfflineSegmentsTask_1628833502672": {
       "subTaskInfos": null,
       "subTaskCount": {
         "waiting": 0,
         "error": 0,
         "total": 1,
         "running": 0,
         "completed": 1
       },
       "startTime": "2021-08-12 22:45:14 PDT",
       "taskState": "COMPLETED",
       "executionStartTime": "2021-08-12 22:45:14 PDT"
     }
   }
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
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 

##########
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;

Review comment:
       changed subTask/SubTask to subtask/Subtask

##########
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 {

Review comment:
       Renamed TaskPartitionDebugInfo to SubtaskDebugInfo




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ramabme commented on a change in pull request #7300: Add debug endpoint to get minion task status.

Posted by GitBox <gi...@apache.org>.
ramabme commented on a change in pull request #7300:
URL: https://github.com/apache/pinot/pull/7300#discussion_r688959810



##########
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));

Review comment:
       cleaned




-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org