Search in sources :

Example 1 with IScalable

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));
}
Also used : UpdateTopologyManager(com.twitter.heron.scheduler.UpdateTopologyManager) IScalable(com.twitter.heron.spi.scheduler.IScalable)

Example 2 with IScalable

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));
}
Also used : TimeUnit(java.util.concurrent.TimeUnit) IScalable(com.twitter.heron.spi.scheduler.IScalable) Lock(com.twitter.heron.spi.statemgr.Lock) SchedulerStateManagerAdaptor(com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with IScalable

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));
}
Also used : UpdateTopologyManager(com.twitter.heron.scheduler.UpdateTopologyManager) IScalable(com.twitter.heron.spi.scheduler.IScalable)

Aggregations

IScalable (com.twitter.heron.spi.scheduler.IScalable)3 UpdateTopologyManager (com.twitter.heron.scheduler.UpdateTopologyManager)2 Lock (com.twitter.heron.spi.statemgr.Lock)1 SchedulerStateManagerAdaptor (com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor)1 TimeUnit (java.util.concurrent.TimeUnit)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1