bug fix for autoscaling termination

This commit is contained in:
Fangjin Yang 2013-01-30 17:06:02 -08:00
parent fa733565e8
commit 26ed96f05d
2 changed files with 14 additions and 17 deletions

View File

@ -177,22 +177,19 @@ public class RemoteTaskRunner implements TaskRunner
return;
}
List<WorkerWrapper> thoseLazyWorkers = Lists.newArrayList(
FunctionalIterable
.create(zkWorkers.values())
.filter(
new Predicate<WorkerWrapper>()
{
@Override
public boolean apply(WorkerWrapper input)
{
return input.getRunningTasks().isEmpty()
&& System.currentTimeMillis() - input.getLastCompletedTaskTime().getMillis()
> config.getMaxWorkerIdleTimeMillisBeforeDeletion();
}
}
)
);
int workerCount = 0;
List<WorkerWrapper> thoseLazyWorkers = Lists.newArrayList();
for (WorkerWrapper workerWrapper : zkWorkers.values()) {
workerCount++;
if (workerCount > workerSetupManager.getWorkerSetupData().getMinNumWorkers() &&
workerWrapper.getRunningTasks().isEmpty() &&
System.currentTimeMillis() - workerWrapper.getLastCompletedTaskTime().getMillis()
> config.getMaxWorkerIdleTimeMillisBeforeDeletion()
) {
thoseLazyWorkers.add(workerWrapper);
}
}
AutoScalingData terminated = strategy.terminate(
Lists.transform(

View File

@ -38,7 +38,7 @@ public abstract class RemoteTaskRunnerConfig extends IndexerZkConfig
public abstract DateTime getTerminateResourcesOriginDateTime();
@Config("druid.indexer.maxWorkerIdleTimeMillisBeforeDeletion")
@Default("10000")
@Default("600000")
public abstract int getMaxWorkerIdleTimeMillisBeforeDeletion();
@Config("druid.indexer.maxScalingDuration")