kfaraz commented on a change in pull request #12221:
URL: https://github.com/apache/druid/pull/12221#discussion_r797508345



##########
File path: 
indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)
   {
     return (worker.getCapacity() - getCurrCapacityUsed() >= 
task.getTaskResource().getRequiredCapacity()
+            && canRunParallelIndexTask(task, parallelIndexWorkerRatio)
             && 
!getAvailabilityGroups().contains(task.getTaskResource().getAvailabilityGroup()));
   }
 
+  public boolean canRunParallelIndexTask(Task task, double 
parallelIndexWorkerRatio)
+  {
+    if (!task.getType().equals(ParallelIndexSupervisorTask.TYPE)) {
+      return true;
+    }
+    return getWorkerParallelIndexCapacity(parallelIndexWorkerRatio) - 
getCurrParallelIndexCapacityUsed()
+           >= task.getTaskResource().getRequiredCapacity();
+
+  }
+
+  private int getWorkerParallelIndexCapacity(double parallelIndexWorkerRatio)
+  {
+    int totalCapcity = worker.getCapacity();
+    int workerParallelIndexCapacity = (int) 
Math.round(parallelIndexWorkerRatio * totalCapcity);
+    if (totalCapcity > 1 && workerParallelIndexCapacity == 0) {

Review comment:
       ```suggestion
       if (workerParallelIndexCapacity < 1) {
   ```
   
   Number of task slots for parallel indexing task should be atleast 1, even if 
totalCapacity is 1.

##########
File path: 
indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java
##########
@@ -119,12 +142,33 @@ public boolean isValidVersion(String minVersion)
     return worker.getVersion().compareTo(minVersion) >= 0;
   }
 
-  public boolean canRunTask(Task task)
+  public boolean canRunTask(Task task, double parallelIndexWorkerRatio)

Review comment:
       Nit: Rename to `parallelIndexTaskSlotRatio`

##########
File path: 
indexing-service/src/main/java/org/apache/druid/indexing/overlord/config/WorkerTaskRunnerConfig.java
##########
@@ -26,8 +26,16 @@
   @JsonProperty
   private String minWorkerVersion = "0";
 
+  @JsonProperty
+  private double parallelIndexWorkerRatio = 0.1;

Review comment:
       Nit: Rename to `parallelIndexTaskSlotRatio`




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