Search in sources :

Example 1 with LauncherStatus

use of org.apache.reef.client.LauncherStatus in project mist by snuspl.

the class MistLauncher method runFromConf.

/**
 * Run the Mist Driver for the given Configuration.
 * @param driverConf The Configuration for the driver
 * @return a status of the driver
 * @throws InjectionException on configuration errors
 */
public LauncherStatus runFromConf(final Configuration driverConf) throws InjectionException {
    final DriverLauncher launcher = DriverLauncher.getLauncher(mistRuntimeConf);
    final Configuration mistDriverConf = getDriverConfiguration(driverConf);
    final LauncherStatus status = timeOut == 0 ? launcher.run(mistDriverConf) : launcher.run(mistDriverConf, timeOut);
    LOG.log(Level.INFO, "Mist completed: {0}", status);
    return status;
}
Also used : DriverConfiguration(org.apache.reef.client.DriverConfiguration) YarnClientConfiguration(org.apache.reef.runtime.yarn.client.YarnClientConfiguration) LocalRuntimeConfiguration(org.apache.reef.runtime.local.client.LocalRuntimeConfiguration) LauncherStatus(org.apache.reef.client.LauncherStatus) DriverLauncher(org.apache.reef.client.DriverLauncher)

Example 2 with LauncherStatus

use of org.apache.reef.client.LauncherStatus in project mist by snuspl.

the class Mist method main.

/**
 * Start Mist Driver.
 * @param args command line parameters.
 */
public static void main(final String[] args) throws Exception {
    final Configuration commandLineConf = getCommandLineConf(args);
    final Injector injector = Tang.Factory.getTang().newInjector(commandLineConf);
    final int mem = injector.getNamedInstance(DriverMemorySize.class);
    if (commandLineConf == null) {
        return;
    }
    final LauncherStatus status = MistLauncher.getLauncherFromConf(commandLineConf).runFromConf(commandLineConf);
    LOG.log(Level.INFO, "Mist completed: {0}", status);
}
Also used : Configuration(org.apache.reef.tang.Configuration) LauncherStatus(org.apache.reef.client.LauncherStatus) Injector(org.apache.reef.tang.Injector)

Example 3 with LauncherStatus

use of org.apache.reef.client.LauncherStatus in project mist by snuspl.

the class MistLauncherTest method testMistLauncher.

/**
 * Test for MistLauncher.
 * @throws InjectionException
 */
@Test
public void testMistLauncher() throws InjectionException {
    final LauncherStatus status = MistLauncher.getLauncher(MistLauncher.RuntimeType.LOCAL).setTimeout(4000).run(2, 4, 1, 256, 1, 256);
    Assert.assertEquals(LauncherStatus.FORCE_CLOSED, status);
}
Also used : LauncherStatus(org.apache.reef.client.LauncherStatus) Test(org.junit.Test)

Example 4 with LauncherStatus

use of org.apache.reef.client.LauncherStatus in project mist by snuspl.

the class MistDriverTest method launchDriverTestHelper.

/**
 * Test whether MistDriver runs MistTaks successfully.
 * @throws InjectionException
 */
public void launchDriverTestHelper(final int clientToTaskPort) throws InjectionException {
    final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
    jcb.bindNamedParameter(DriverRuntimeType.class, "LOCAL");
    jcb.bindNamedParameter(NumTaskCores.class, "1");
    jcb.bindNamedParameter(DefaultNumEventProcessors.class, "1");
    jcb.bindNamedParameter(TaskMemorySize.class, "256");
    jcb.bindNamedParameter(NumMasterCores.class, "1");
    jcb.bindNamedParameter(MasterMemorySize.class, "256");
    jcb.bindNamedParameter(ClientToTaskPort.class, Integer.toString(clientToTaskPort));
    final Configuration runtimeConf = LocalRuntimeConfiguration.CONF.build();
    final Configuration driverConf = MistLauncher.getDriverConfiguration(jcb.build());
    final LauncherStatus state = TestLauncher.run(runtimeConf, driverConf, 5000);
    final Optional<Throwable> err = state.getError();
    System.out.println("Job state after execution: " + state);
    System.out.println("Error: " + err.get());
    Assert.assertFalse(err.isPresent());
}
Also used : Configuration(org.apache.reef.tang.Configuration) LocalRuntimeConfiguration(org.apache.reef.runtime.local.client.LocalRuntimeConfiguration) LauncherStatus(org.apache.reef.client.LauncherStatus) JavaConfigurationBuilder(org.apache.reef.tang.JavaConfigurationBuilder)

Example 5 with LauncherStatus

use of org.apache.reef.client.LauncherStatus in project mist by snuspl.

the class MistDriverTest method launchDriverTestHelper.

/**
 * Test whether MistDriver runs MistTaks successfully.
 * @throws InjectionException
 */
public void launchDriverTestHelper() throws InjectionException {
    final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
    jcb.bindNamedParameter(DriverRuntimeType.class, "LOCAL");
    jcb.bindNamedParameter(NumTaskCores.class, "1");
    jcb.bindNamedParameter(DefaultNumEventProcessors.class, "1");
    jcb.bindNamedParameter(TaskMemorySize.class, "256");
    jcb.bindNamedParameter(NumMasterCores.class, "1");
    jcb.bindNamedParameter(MasterMemorySize.class, "256");
    final Configuration runtimeConf = LocalRuntimeConfiguration.CONF.build();
    final Configuration driverConf = MistLauncher.getDriverConfiguration(jcb.build());
    final LauncherStatus state = TestLauncher.run(runtimeConf, driverConf, 4000);
    final Optional<Throwable> err = state.getError();
    System.out.println("Job state after execution: " + state);
    System.out.println("Error: " + err.get());
    Assert.assertFalse(err.isPresent());
}
Also used : Configuration(org.apache.reef.tang.Configuration) LocalRuntimeConfiguration(org.apache.reef.runtime.local.client.LocalRuntimeConfiguration) LauncherStatus(org.apache.reef.client.LauncherStatus) JavaConfigurationBuilder(org.apache.reef.tang.JavaConfigurationBuilder)

Aggregations

LauncherStatus (org.apache.reef.client.LauncherStatus)5 LocalRuntimeConfiguration (org.apache.reef.runtime.local.client.LocalRuntimeConfiguration)3 Configuration (org.apache.reef.tang.Configuration)3 JavaConfigurationBuilder (org.apache.reef.tang.JavaConfigurationBuilder)2 DriverConfiguration (org.apache.reef.client.DriverConfiguration)1 DriverLauncher (org.apache.reef.client.DriverLauncher)1 YarnClientConfiguration (org.apache.reef.runtime.yarn.client.YarnClientConfiguration)1 Injector (org.apache.reef.tang.Injector)1 Test (org.junit.Test)1