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

View File

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