tibrewalpratik17 commented on code in PR #14257:
URL: https://github.com/apache/pinot/pull/14257#discussion_r1808697125


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java:
##########
@@ -589,6 +601,13 @@ private synchronized List<String> scheduleTask(String 
taskType, List<String> tab
     PinotTaskGenerator taskGenerator = 
_taskGeneratorRegistry.getTaskGenerator(taskType);
     Preconditions.checkState(taskGenerator != null, "Task type: %s is not 
registered", taskType);
 
+    TaskState taskState = 
_helixTaskResourceManager.getTaskQueueState(taskType);
+    if (TaskState.STOPPED.equals(taskState) || 
TaskState.STOPPING.equals(taskState)) {
+      LOGGER.warn("Task queue is in state: {}. Tasks won't be scheduled for 
taskType: {} and tables: {}. Resume task "
+          + "queue before attempting to schedule tasks.", taskState.name(), 
taskType, tables);
+      return new ArrayList<>();
+    }

Review Comment:
   we can move this logic inside below method:
   ```
   @Nullable
     private List<String> scheduleTask(PinotTaskGenerator taskGenerator, 
List<TableConfig> enabledTableConfigs,
         boolean isLeader, @Nullable String minionInstanceTagForTask) {
   ``` 
   to reuse across schedule / adhoc triggers.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to