gianm commented on code in PR #14546:
URL: https://github.com/apache/druid/pull/14546#discussion_r1256407649


##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/ImmutableWorkerInfo.java:
##########
@@ -90,6 +94,48 @@ public ImmutableWorkerInfo(
     this(worker, currCapacityUsed, 0, availabilityGroups, runningTasks, 
lastCompletedTaskTime, null);
   }
 
+  public static ImmutableWorkerInfo fromWorkerAnnouncements(
+      final Worker worker,
+      final Map<String, TaskAnnouncement> announcements,
+      final DateTime lastCompletedTaskTime,
+      @Nullable final DateTime blacklistedUntil
+  )
+  {
+    int currCapacityUsed = 0;
+    int currParallelIndexCapacityUsed = 0;
+    ImmutableSet.Builder<String> taskIds = ImmutableSet.builder();
+    ImmutableSet.Builder<String> availabilityGroups = ImmutableSet.builder();
+
+    for (final Map.Entry<String, TaskAnnouncement> entry : 
announcements.entrySet()) {
+      final TaskAnnouncement announcement = entry.getValue();
+
+      if (announcement.getStatus().isRunnable()) {

Review Comment:
   Hmm, I didn't notice this behavioral difference til now. I think the 
filtering on `isRunnable` is the correct thing to do: tasks don't use slots 
when they aren't running, so they shouldn't be counted.
   
   With this change, some `RemoteTaskRunnerTest` cases need to be adjusted, but 
I think that's OK. Note that in most cases, tasks get removed from the 
announcement set pretty quickly after they complete, so I don't expect a big 
practical difference in prod.



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