use of com.twitter.heron.spi.scheduler.IScalable in project heron by twitter.
the class AuroraScheduler method initialize.
@Override
public void initialize(Config mConfig, Config mRuntime) {
this.config = Config.toClusterMode(mConfig);
this.runtime = mRuntime;
this.controller = getController();
this.updateTopologyManager = new UpdateTopologyManager(config, runtime, Optional.<IScalable>of(this));
}
use of com.twitter.heron.spi.scheduler.IScalable in project heron by twitter.
the class UpdateTopologyManagerTest method requestsToAddAndRemoveContainers.
/**
* Test scalable scheduler invocation
*/
@Test
@PrepareForTest(TMasterUtils.class)
public void requestsToAddAndRemoveContainers() throws Exception {
Lock lock = mockLock(true);
SchedulerStateManagerAdaptor mockStateMgr = mockStateManager(testTopology, this.currentProtoPlan, lock);
IScalable mockScheduler = mock(IScalable.class);
UpdateTopologyManager spyUpdateManager = spyUpdateManager(mockStateMgr, mockScheduler, testTopology);
PowerMockito.spy(TMasterUtils.class);
PowerMockito.doNothing().when(TMasterUtils.class, "sendToTMaster", any(String.class), eq(TOPOLOGY_NAME), eq(mockStateMgr), any(NetworkUtils.TunnelConfig.class));
spyUpdateManager.updateTopology(currentProtoPlan, proposedProtoPlan);
verify(spyUpdateManager).deactivateTopology(eq(mockStateMgr), eq(testTopology));
verify(spyUpdateManager).reactivateTopology(eq(mockStateMgr), eq(testTopology), eq(2));
verify(mockScheduler).addContainers(expectedContainersToAdd);
verify(mockScheduler).removeContainers(expectedContainersToRemove);
verify(lock).tryLock(any(Long.class), any(TimeUnit.class));
verify(lock).unlock();
PowerMockito.verifyStatic(times(1));
TMasterUtils.transitionTopologyState(eq(TOPOLOGY_NAME), eq(TMasterUtils.TMasterCommand.DEACTIVATE), eq(mockStateMgr), eq(TopologyAPI.TopologyState.RUNNING), eq(TopologyAPI.TopologyState.PAUSED), any(NetworkUtils.TunnelConfig.class));
PowerMockito.verifyStatic(times(1));
TMasterUtils.transitionTopologyState(eq(TOPOLOGY_NAME), eq(TMasterUtils.TMasterCommand.ACTIVATE), eq(mockStateMgr), eq(TopologyAPI.TopologyState.PAUSED), eq(TopologyAPI.TopologyState.RUNNING), any(NetworkUtils.TunnelConfig.class));
}
use of com.twitter.heron.spi.scheduler.IScalable in project heron by twitter.
the class LocalScheduler method initialize.
@Override
public void initialize(Config mConfig, Config mRuntime) {
this.config = mConfig;
this.runtime = mRuntime;
this.updateTopologyManager = new UpdateTopologyManager(config, runtime, Optional.<IScalable>of(this));
}
Aggregations