Class CoordinatorDutyUtils
- java.lang.Object
-
- org.apache.druid.server.coordinator.duty.CoordinatorDutyUtils
-
public class CoordinatorDutyUtils extends Object
utilty methods that are useful for coordinator duties
-
-
Constructor Summary
Constructors Constructor Description CoordinatorDutyUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<org.apache.druid.indexer.TaskStatusPlus>getNumActiveTaskSlots(OverlordClient overlordClient, com.google.common.base.Predicate<org.apache.druid.indexer.TaskStatusPlus> taskPredicate)Return the number of active tasks that match the task predicate provided.static intgetTotalWorkerCapacity(OverlordClient overlordClient)Returns the total worker capacity in the cluster, including autoscaling, if enabled.
-
-
-
Method Detail
-
getTotalWorkerCapacity
public static int getTotalWorkerCapacity(@Nonnull OverlordClient overlordClient)
Returns the total worker capacity in the cluster, including autoscaling, if enabled.- Parameters:
overlordClient- The overlord client used to get worker capacity info.- Returns:
- the total worker capacity in the cluster, including autoscaling, if enabled.
-
getNumActiveTaskSlots
public static List<org.apache.druid.indexer.TaskStatusPlus> getNumActiveTaskSlots(@Nonnull OverlordClient overlordClient, com.google.common.base.Predicate<org.apache.druid.indexer.TaskStatusPlus> taskPredicate)
Return the number of active tasks that match the task predicate provided. The number of active tasks returned may be an overestimate, as tasks that return status's with null types will be conservatively counted to match the predicate provided.- Parameters:
overlordClient- The overlord client to use to retrieve the list of active tasks.taskPredicate- The predicate to match against the list of retreived task status. This predicate will never be called with a null task status.- Returns:
- the number of active tasks that match the task predicate provided
-
-