Search in sources :

Example 1 with TezUserPayloadProto

use of org.apache.tez.dag.api.records.DAGProtos.TezUserPayloadProto in project tez by apache.

the class TestDAGAppMaster method testParseAllPluginsCustomAndYarnSpecified.

@Test(timeout = 5000)
public void testParseAllPluginsCustomAndYarnSpecified() throws IOException {
    Configuration conf = new Configuration(false);
    conf.set(TEST_KEY, TEST_VAL);
    UserPayload defaultPayload = TezUtils.createUserPayloadFromConf(conf);
    TezUserPayloadProto payloadProto = TezUserPayloadProto.newBuilder().setUserPayload(ByteString.copyFrom(defaultPayload.getPayload())).build();
    AMPluginDescriptorProto proto = createAmPluginDescriptor(true, false, true, payloadProto);
    List<NamedEntityDescriptor> tsDescriptors;
    BiMap<String, Integer> tsMap;
    List<NamedEntityDescriptor> clDescriptors;
    BiMap<String, Integer> clMap;
    List<NamedEntityDescriptor> tcDescriptors;
    BiMap<String, Integer> tcMap;
    // Only plugin, Yarn.
    tsDescriptors = Lists.newLinkedList();
    tsMap = HashBiMap.create();
    clDescriptors = Lists.newLinkedList();
    clMap = HashBiMap.create();
    tcDescriptors = Lists.newLinkedList();
    tcMap = HashBiMap.create();
    DAGAppMaster.parseAllPlugins(tsDescriptors, tsMap, clDescriptors, clMap, tcDescriptors, tcMap, proto, false, defaultPayload);
    verifyDescAndMap(tsDescriptors, tsMap, 2, true, TezConstants.getTezYarnServicePluginName(), TS_NAME);
    verifyDescAndMap(clDescriptors, clMap, 2, true, TezConstants.getTezYarnServicePluginName(), CL_NAME);
    verifyDescAndMap(tcDescriptors, tcMap, 2, true, TezConstants.getTezYarnServicePluginName(), TC_NAME);
    assertNull(tsDescriptors.get(0).getClassName());
    assertNull(clDescriptors.get(0).getClassName());
    assertNull(tcDescriptors.get(0).getClassName());
    assertEquals(TS_NAME + CLASS_SUFFIX, tsDescriptors.get(1).getClassName());
    assertEquals(CL_NAME + CLASS_SUFFIX, clDescriptors.get(1).getClassName());
    assertEquals(TC_NAME + CLASS_SUFFIX, tcDescriptors.get(1).getClassName());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) UserPayload(org.apache.tez.dag.api.UserPayload) AMPluginDescriptorProto(org.apache.tez.dag.api.records.DAGProtos.AMPluginDescriptorProto) TezUserPayloadProto(org.apache.tez.dag.api.records.DAGProtos.TezUserPayloadProto) ByteString(com.google.protobuf.ByteString) NamedEntityDescriptor(org.apache.tez.dag.api.NamedEntityDescriptor) Test(org.junit.Test)

Example 2 with TezUserPayloadProto

use of org.apache.tez.dag.api.records.DAGProtos.TezUserPayloadProto in project tez by apache.

the class TestDAGAppMaster method testParseAllPluginsOnlyCustomSpecified.

@Test(timeout = 5000)
public void testParseAllPluginsOnlyCustomSpecified() throws IOException {
    Configuration conf = new Configuration(false);
    conf.set(TEST_KEY, TEST_VAL);
    UserPayload defaultPayload = TezUtils.createUserPayloadFromConf(conf);
    TezUserPayloadProto payloadProto = TezUserPayloadProto.newBuilder().setUserPayload(ByteString.copyFrom(defaultPayload.getPayload())).build();
    AMPluginDescriptorProto proto = createAmPluginDescriptor(false, false, true, payloadProto);
    List<NamedEntityDescriptor> tsDescriptors;
    BiMap<String, Integer> tsMap;
    List<NamedEntityDescriptor> clDescriptors;
    BiMap<String, Integer> clMap;
    List<NamedEntityDescriptor> tcDescriptors;
    BiMap<String, Integer> tcMap;
    // Only plugin, Yarn.
    tsDescriptors = Lists.newLinkedList();
    tsMap = HashBiMap.create();
    clDescriptors = Lists.newLinkedList();
    clMap = HashBiMap.create();
    tcDescriptors = Lists.newLinkedList();
    tcMap = HashBiMap.create();
    DAGAppMaster.parseAllPlugins(tsDescriptors, tsMap, clDescriptors, clMap, tcDescriptors, tcMap, proto, false, defaultPayload);
    verifyDescAndMap(tsDescriptors, tsMap, 2, true, TS_NAME, TezConstants.getTezYarnServicePluginName());
    verifyDescAndMap(clDescriptors, clMap, 1, true, CL_NAME);
    verifyDescAndMap(tcDescriptors, tcMap, 1, true, TC_NAME);
    assertEquals(TS_NAME + CLASS_SUFFIX, tsDescriptors.get(0).getClassName());
    assertEquals(CL_NAME + CLASS_SUFFIX, clDescriptors.get(0).getClassName());
    assertEquals(TC_NAME + CLASS_SUFFIX, tcDescriptors.get(0).getClassName());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) UserPayload(org.apache.tez.dag.api.UserPayload) AMPluginDescriptorProto(org.apache.tez.dag.api.records.DAGProtos.AMPluginDescriptorProto) TezUserPayloadProto(org.apache.tez.dag.api.records.DAGProtos.TezUserPayloadProto) ByteString(com.google.protobuf.ByteString) NamedEntityDescriptor(org.apache.tez.dag.api.NamedEntityDescriptor) Test(org.junit.Test)

Aggregations

ByteString (com.google.protobuf.ByteString)2 Configuration (org.apache.hadoop.conf.Configuration)2 NamedEntityDescriptor (org.apache.tez.dag.api.NamedEntityDescriptor)2 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)2 UserPayload (org.apache.tez.dag.api.UserPayload)2 AMPluginDescriptorProto (org.apache.tez.dag.api.records.DAGProtos.AMPluginDescriptorProto)2 TezUserPayloadProto (org.apache.tez.dag.api.records.DAGProtos.TezUserPayloadProto)2 Test (org.junit.Test)2