use of org.apache.heron.scheduler.utils.LauncherUtils in project heron by twitter.
the class KubernetesLauncher method launch.
@Override
public boolean launch(PackingPlan packing) {
LauncherUtils launcherUtils = LauncherUtils.getInstance();
Config ytruntime = launcherUtils.createConfigWithPackingDetails(runtime, packing);
return launcherUtils.onScheduleAsLibrary(config, ytruntime, getScheduler(), packing);
}
use of org.apache.heron.scheduler.utils.LauncherUtils in project heron by twitter.
the class AuroraLauncherTest method testLaunch.
@Test
public void testLaunch() throws Exception {
Config config = Config.newBuilder().build();
AuroraLauncher launcher = Mockito.spy(AuroraLauncher.class);
launcher.initialize(config, config);
LauncherUtils mockLauncherUtils = Mockito.mock(LauncherUtils.class);
PowerMockito.spy(LauncherUtils.class);
PowerMockito.doReturn(mockLauncherUtils).when(LauncherUtils.class, "getInstance");
// Failed to schedule
Mockito.when(mockLauncherUtils.onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class))).thenReturn(false);
Assert.assertFalse(launcher.launch(Mockito.mock(PackingPlan.class)));
Mockito.verify(mockLauncherUtils).onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class));
// Happy path
Mockito.when(mockLauncherUtils.onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class))).thenReturn(true);
Assert.assertTrue(launcher.launch(Mockito.mock(PackingPlan.class)));
Mockito.verify(mockLauncherUtils, Mockito.times(2)).onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class));
launcher.close();
}
use of org.apache.heron.scheduler.utils.LauncherUtils in project heron by twitter.
the class KubernetesLauncherTest method testLaunch.
@Test
public void testLaunch() throws Exception {
Config config = Config.newBuilder().build();
KubernetesLauncher launcher = Mockito.spy(KubernetesLauncher.class);
launcher.initialize(config, config);
LauncherUtils mockLauncherUtils = Mockito.mock(LauncherUtils.class);
PowerMockito.spy(LauncherUtils.class);
PowerMockito.doReturn(mockLauncherUtils).when(LauncherUtils.class, "getInstance");
// Launched successfully
Mockito.when(mockLauncherUtils.onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class))).thenReturn(true);
Assert.assertTrue(launcher.launch(Mockito.mock(PackingPlan.class)));
Mockito.verify(mockLauncherUtils).onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class));
// Failed to launch
Mockito.when(mockLauncherUtils.onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class))).thenReturn(false);
Assert.assertFalse(launcher.launch(Mockito.mock(PackingPlan.class)));
Mockito.verify(mockLauncherUtils, Mockito.times(2)).onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class));
launcher.close();
}
use of org.apache.heron.scheduler.utils.LauncherUtils in project heron by twitter.
the class SlurmLauncher method launch.
@Override
public boolean launch(PackingPlan packing) {
LOG.log(Level.FINE, "Launching topology for local cluster {0}", SlurmContext.cluster(config));
// this working directory is a shared directory among the nodes
if (!setupWorkingDirectory()) {
LOG.log(Level.SEVERE, "Failed to download the core and topology packages");
return false;
}
LauncherUtils launcherUtils = LauncherUtils.getInstance();
Config ytruntime = launcherUtils.createConfigWithPackingDetails(runtime, packing);
return launcherUtils.onScheduleAsLibrary(config, ytruntime, new SlurmScheduler(topologyWorkingDirectory), packing);
}
use of org.apache.heron.scheduler.utils.LauncherUtils in project heron by twitter.
the class MarathonLauncherTest method testLaunch.
@Test
public void testLaunch() throws Exception {
Config config = Config.newBuilder().build();
MarathonLauncher launcher = Mockito.spy(MarathonLauncher.class);
launcher.initialize(config, config);
LauncherUtils mockLauncherUtils = Mockito.mock(LauncherUtils.class);
PowerMockito.spy(LauncherUtils.class);
PowerMockito.doReturn(mockLauncherUtils).when(LauncherUtils.class, "getInstance");
// Launched successfully
Mockito.when(mockLauncherUtils.onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class))).thenReturn(true);
Assert.assertTrue(launcher.launch(Mockito.mock(PackingPlan.class)));
Mockito.verify(mockLauncherUtils).onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class));
// Failed to launch
Mockito.when(mockLauncherUtils.onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class))).thenReturn(false);
Assert.assertFalse(launcher.launch(Mockito.mock(PackingPlan.class)));
Mockito.verify(mockLauncherUtils, Mockito.times(2)).onScheduleAsLibrary(Mockito.any(Config.class), Mockito.any(Config.class), Mockito.any(IScheduler.class), Mockito.any(PackingPlan.class));
launcher.close();
}
Aggregations