sajjad-moradi commented on code in PR #14596:
URL: https://github.com/apache/pinot/pull/14596#discussion_r1870299501


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/refreshsegment/RefreshSegmentTaskGenerator.java:
##########
@@ -54,84 +54,99 @@ public String getTaskType() {
 
   @Override
   public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
-    String taskType = RefreshSegmentTask.TASK_TYPE;
     List<PinotTaskConfig> pinotTaskConfigs = new ArrayList<>();
-    PinotHelixResourceManager pinotHelixResourceManager = 
_clusterInfoAccessor.getPinotHelixResourceManager();
-
-    int tableNumTasks = 0;
-
     for (TableConfig tableConfig : tableConfigs) {
-      String tableNameWithType = tableConfig.getTableName();
-      LOGGER.info("Start generating RefreshSegment tasks for table: {}", 
tableNameWithType);
-
       // Get the task configs for the table. This is used to restrict the 
maximum number of allowed tasks per table at
       // any given point.
       Map<String, String> taskConfigs;
       TableTaskConfig tableTaskConfig = tableConfig.getTaskConfig();
       if (tableTaskConfig == null) {
-        LOGGER.warn("Failed to find task config for table: {}", 
tableNameWithType);
+        LOGGER.warn("Failed to find task config for table: {}", 
tableConfig.getTableName());
         continue;
       }
       taskConfigs = 
tableTaskConfig.getConfigsForTaskType(RefreshSegmentTask.TASK_TYPE);
-      Preconditions.checkNotNull(taskConfigs, "Task config shouldn't be null 
for Table: %s", tableNameWithType);
-      int tableMaxNumTasks = RefreshSegmentTask.MAX_NUM_TASKS_PER_TABLE;
-      String tableMaxNumTasksConfig = 
taskConfigs.get(MinionConstants.TABLE_MAX_NUM_TASKS_KEY);
-      if (tableMaxNumTasksConfig != null) {
-        try {
-          tableMaxNumTasks = Integer.parseInt(tableMaxNumTasksConfig);
-        } catch (Exception e) {
-          tableMaxNumTasks = RefreshSegmentTask.MAX_NUM_TASKS_PER_TABLE;
-          LOGGER.warn("MaxNumTasks have been wrongly set for table : {}, and 
task {}", tableNameWithType, taskType);
-        }
+      Preconditions.checkNotNull(taskConfigs, "Task config shouldn't be null 
for Table: %s",
+          tableConfig.getTableName());

Review Comment:
   nit: this precondition is repeated in both `generatedTasks` methods. It can 
be moved to `generatedTaskForTable` method to avoid duplication. 



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