mcvsubbu commented on a change in pull request #7091:
URL: https://github.com/apache/incubator-pinot/pull/7091#discussion_r659966207



##########
File path: 
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SimpleMinionClusterIntegrationTest.java
##########
@@ -85,20 +85,44 @@ public void setUp()
     startMinion();
   }
 
+  private void verifyTaskCount(String task, int errors, int waiting, int 
running, int total) {
+    PinotHelixTaskResourceManager.TaskCount taskCount = 
_helixTaskResourceManager.getTaskCount(task);
+    assertEquals(taskCount.getError(), errors);
+    assertEquals(taskCount.getWaiting(), waiting);
+    assertEquals(taskCount.getRunning(), running);
+    assertEquals(taskCount.getTotal(), total);
+  }
+
   @Test
   public void testStopResumeDeleteTaskQueue() {
     // Hold the task
     HOLD.set(true);
+    // No tasks before we start.
+    
assertEquals(_helixTaskResourceManager.getTasksInProgress(TASK_TYPE).size(),0);
+    verifyTaskCount("Task_" + TASK_TYPE + "_1624403781879", 0, 0, 0, 0);
 
     // Should create the task queues and generate a task
-    assertNotNull(_taskManager.scheduleTasks().get(TASK_TYPE));
+    String task1 = _taskManager.scheduleTasks().get(TASK_TYPE);
+    assertNotNull(task1);
     assertTrue(_helixTaskResourceManager.getTaskQueues()
         
.contains(PinotHelixTaskResourceManager.getHelixJobQueueName(TASK_TYPE)));
-
-    // Should generate one more task
-    assertNotNull(_taskManager.scheduleTask(TASK_TYPE));
-
-    // Should not generate more tasks
+    
assertTrue(_helixTaskResourceManager.getTasksInProgress(TASK_TYPE).contains(task1));
+
+    // Since we have two tables, two sub-tasks are generated -- one for each 
table.
+    // The default concurrent sub-tasks per minion instance is 1, and we have 
one minion
+    // instance spun up. So, one sub-tasks gets scheduled in a minion, and the 
other one
+    // waits.
+    verifyTaskCount(task1, 0, 1, 1, 2);
+    // Should generate one more task, with two sub-tasks. Both of these 
sub-tasks will wait
+    // since we have one minion instance that is still running one of the 
sub-tasks.

Review comment:
       Minions run sub-tasks. We queue tasks that have sub-tasks. Task1 had two 
sub-tasks out of which one is running in minion. Task2 had two sub-tasks, but 
none of them can run on minion because there is already _a_ sub-task running on 
minion. Therefore, task1's count shows 1 running, and task2's count shows 0 
running.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

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



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

Reply via email to