georgew5656 commented on code in PR #14888:
URL: https://github.com/apache/druid/pull/14888#discussion_r1304351583
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java:
##########
@@ -469,27 +467,17 @@ public Response getWorkerConfig()
public Response getTotalWorkerCapacity()
{
// Calculate current cluster capacity
- int currentCapacity;
Optional<TaskRunner> taskRunnerOptional = taskMaster.getTaskRunner();
if (!taskRunnerOptional.isPresent()) {
// Cannot serve call as not leader
return Response.status(Response.Status.SERVICE_UNAVAILABLE).build();
}
TaskRunner taskRunner = taskRunnerOptional.get();
- Collection<ImmutableWorkerInfo> workers;
- if (taskRunner instanceof WorkerTaskRunner) {
- workers = ((WorkerTaskRunner) taskRunner).getWorkers();
- currentCapacity = workers.stream().mapToInt(workerInfo ->
workerInfo.getWorker().getCapacity()).sum();
- } else {
- log.debug(
- "Cannot calculate capacity as task runner [%s] of type [%s] does not
support listing workers",
- taskRunner,
- taskRunner.getClass().getName()
- );
- workers = ImmutableList.of();
- currentCapacity = -1;
- }
+ Collection<ImmutableWorkerInfo> workers = taskRunner instanceof
WorkerTaskRunner ?
Review Comment:
for capacity with autoscaling, it looks like if capacity hint is not passed
it tries to assume each worker has the same capacity when calculating max
capacity, so it needs at least a single worker as an example.
--
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]