Search in sources :

Example 1 with CommandInfo

use of org.apache.mesos.Protos.CommandInfo in project incubator-myriad by apache.

the class ByteBufferSupportTest method getExecutorInfo.

private ExecutorInfo getExecutorInfo() {
    FrameworkID id = Protos.FrameworkID.newBuilder().setValue("framework1").build();
    ExecutorID eid = Protos.ExecutorID.newBuilder().setValue("executor1").build();
    CommandInfo cm = Protos.CommandInfo.newBuilder().setValue("command").build();
    return ExecutorInfo.newBuilder().setFrameworkId(id).setExecutorId(eid).setCommand(cm).build();
}
Also used : ExecutorID(org.apache.mesos.Protos.ExecutorID) CommandInfo(org.apache.mesos.Protos.CommandInfo) FrameworkID(org.apache.mesos.Protos.FrameworkID)

Example 2 with CommandInfo

use of org.apache.mesos.Protos.CommandInfo in project incubator-myriad by apache.

the class TestServiceCommandLine method testNMCommandLineGeneration.

@Test
public void testNMCommandLineGeneration() throws Exception {
    Long[] ports = new Long[] { 1L, 2L, 3L, 4L };
    List<Long> nmPorts = Arrays.asList(ports);
    Map<String, Long> portsMap = new TreeMap<>();
    portsMap.put(KEY_NM_ADDRESS, 0L);
    portsMap.put(KEY_NM_WEBAPP_ADDRESS, 0L);
    portsMap.put(KEY_NM_LOCALIZER_ADDRESS, 0L);
    portsMap.put(KEY_NM_SHUFFLE_PORT, 0L);
    ServiceResourceProfile profile = new ExtendedResourceProfile(new NMProfile("nm", 10L, 15L), 3.0, 5.0, portsMap);
    ExecutorCommandLineGenerator clGenerator = new NMExecutorCommandLineGenerator(cfg);
    CommandInfo cInfo = clGenerator.generateCommandLine(profile, null, nmPorts);
    String testVal = String.format(CMD_FORMAT, toCompare);
    assertTrue(String.format(msgFormat, cInfo.getValue(), testVal), cInfo.getValue().equals(testVal));
    List<Protos.Environment.Variable> environmentList = cInfo.getEnvironment().getVariablesList();
    String yarnOpts = "";
    for (Protos.Environment.Variable variable : environmentList) {
        if (variable.getName().equals(NMExecutorCommandLineGenerator.ENV_YARN_NODEMANAGER_OPTS)) {
            yarnOpts = variable.getValue();
        }
    }
    System.out.println(yarnOpts);
    assertTrue("Environment contains " + NMExecutorCommandLineGenerator.ENV_YARN_NODEMANAGER_OPTS, StringUtils.isNotEmpty(yarnOpts));
    assertTrue(NMExecutorCommandLineGenerator.ENV_YARN_NODEMANAGER_OPTS + " must contain -D" + KEY_NM_SHUFFLE_PORT + "=1", yarnOpts.contains(KEY_NM_SHUFFLE_PORT + "=1"));
}
Also used : CommandInfo(org.apache.mesos.Protos.CommandInfo) Protos(org.apache.mesos.Protos) Test(org.junit.Test) BaseConfigurableTest(org.apache.myriad.BaseConfigurableTest)

Example 3 with CommandInfo

use of org.apache.mesos.Protos.CommandInfo in project incubator-myriad by apache.

the class TestServiceCommandLine method testJHSCommandLineGeneration.

@Test
public void testJHSCommandLineGeneration() throws Exception {
    Map<String, Long> portsMap = new TreeMap<>();
    portsMap.put(KEY_JHS_ADDRESS, 0L);
    portsMap.put(KEY_JHS_WEBAPP_ADDRESS, 3L);
    portsMap.put(KEY_JHS_ADMIN_ADDRESS, 0L);
    ServiceResourceProfile profile = new ServiceResourceProfile("jobhistory", 10.0, 15.0, portsMap);
    ServiceConfiguration serviceConfiguration = cfg.getServiceConfiguration("jobhistory").get();
    ServiceCommandLineGenerator serviceCommandLineGenerator = new ServiceCommandLineGenerator(cfg);
    List<Long> ports = new ArrayList<>();
    ports.add(2L);
    ports.add(1L);
    ports.add(3L);
    CommandInfo cInfo = serviceCommandLineGenerator.generateCommandLine(profile, serviceConfiguration, ports);
    String testVal = String.format(CMD_FORMAT, toJHSCompare);
    assertTrue(String.format(msgFormat, cInfo.getValue(), testVal), cInfo.getValue().equals(testVal));
    List<Protos.Environment.Variable> environmentList = cInfo.getEnvironment().getVariablesList();
    String yarnOpts = "";
    for (Protos.Environment.Variable variable : environmentList) {
        if (variable.getName().equals(ServiceCommandLineGenerator.ENV_HADOOP_OPTS)) {
            yarnOpts = variable.getValue();
        }
    }
    assertTrue("Environment contains " + ServiceCommandLineGenerator.ENV_HADOOP_OPTS, StringUtils.isNotEmpty(yarnOpts));
    System.out.println(yarnOpts);
    assertTrue(ServiceCommandLineGenerator.ENV_HADOOP_OPTS + " must contain -D" + KEY_JHS_WEBAPP_ADDRESS + "=0.0.0.0:3", yarnOpts.contains(KEY_JHS_WEBAPP_ADDRESS + "=0.0.0.0:3"));
}
Also used : CommandInfo(org.apache.mesos.Protos.CommandInfo) ServiceConfiguration(org.apache.myriad.configuration.ServiceConfiguration) Protos(org.apache.mesos.Protos) Test(org.junit.Test) BaseConfigurableTest(org.apache.myriad.BaseConfigurableTest)

Aggregations

CommandInfo (org.apache.mesos.Protos.CommandInfo)3 Protos (org.apache.mesos.Protos)2 BaseConfigurableTest (org.apache.myriad.BaseConfigurableTest)2 Test (org.junit.Test)2 ExecutorID (org.apache.mesos.Protos.ExecutorID)1 FrameworkID (org.apache.mesos.Protos.FrameworkID)1 ServiceConfiguration (org.apache.myriad.configuration.ServiceConfiguration)1