Search in sources :

Example 11 with ILauncher

use of com.twitter.heron.spi.scheduler.ILauncher in project incubator-heron by apache.

the class LaunchRunnerTest method testSetExecutionStateFail.

@Test(expected = LauncherException.class)
public void testSetExecutionStateFail() throws Exception {
    Config runtime = createRunnerRuntime();
    Config config = createRunnerConfig();
    ILauncher launcher = Runtime.launcherClassInstance(runtime);
    LaunchRunner launchRunner = new LaunchRunner(config, runtime);
    SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime);
    when(statemgr.setExecutionState(any(ExecutionEnvironment.ExecutionState.class), eq(TOPOLOGY_NAME))).thenReturn(false);
    try {
        launchRunner.call();
    } finally {
        verify(launcher, never()).launch(any(PackingPlan.class));
    }
}
Also used : ILauncher(com.twitter.heron.spi.scheduler.ILauncher) Config(com.twitter.heron.spi.common.Config) PackingPlan(com.twitter.heron.spi.packing.PackingPlan) SchedulerStateManagerAdaptor(com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 12 with ILauncher

use of com.twitter.heron.spi.scheduler.ILauncher in project incubator-heron by apache.

the class LaunchRunnerTest method doTestLaunch.

private void doTestLaunch(com.twitter.heron.api.Config topologyConfig) throws Exception {
    Config runtime = createRunnerRuntime(topologyConfig);
    Config config = createRunnerConfig();
    ILauncher launcher = Runtime.launcherClassInstance(runtime);
    SchedulerStateManagerAdaptor statemgr = createTestSchedulerStateManager(runtime);
    LaunchRunner launchRunner = new LaunchRunner(config, runtime);
    when(launcher.launch(any(PackingPlan.class))).thenReturn(true);
    launchRunner.call();
    // Verify set && clean
    verify(statemgr).setTopology(any(TopologyAPI.Topology.class), eq(TOPOLOGY_NAME));
    verify(statemgr).setExecutionState(any(ExecutionEnvironment.ExecutionState.class), eq(TOPOLOGY_NAME));
    verify(statemgr, never()).deleteExecutionState(eq(TOPOLOGY_NAME));
    verify(statemgr, never()).deleteTopology(eq(TOPOLOGY_NAME));
}
Also used : ILauncher(com.twitter.heron.spi.scheduler.ILauncher) Config(com.twitter.heron.spi.common.Config) PackingPlan(com.twitter.heron.spi.packing.PackingPlan) HeronTopology(com.twitter.heron.api.HeronTopology) SchedulerStateManagerAdaptor(com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor)

Aggregations

Config (com.twitter.heron.spi.common.Config)12 PackingPlan (com.twitter.heron.spi.packing.PackingPlan)12 ILauncher (com.twitter.heron.spi.scheduler.ILauncher)12 SchedulerStateManagerAdaptor (com.twitter.heron.spi.statemgr.SchedulerStateManagerAdaptor)12 HeronTopology (com.twitter.heron.api.HeronTopology)6 Test (org.junit.Test)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 TopologyAPI (com.twitter.heron.api.generated.TopologyAPI)2 LauncherUtils (com.twitter.heron.scheduler.utils.LauncherUtils)2 IPacking (com.twitter.heron.spi.packing.IPacking)2 PackingException (com.twitter.heron.spi.packing.PackingException)2 ContainerPlan (com.twitter.heron.spi.packing.PackingPlan.ContainerPlan)2 LauncherException (com.twitter.heron.spi.scheduler.LauncherException)2 IStateManager (com.twitter.heron.spi.statemgr.IStateManager)2 IUploader (com.twitter.heron.spi.uploader.IUploader)2 UploaderException (com.twitter.heron.spi.uploader.UploaderException)2 URI (java.net.URI)2 HashSet (java.util.HashSet)2