Search in sources :

Example 21 with NamedEntityDescriptor

use of org.apache.tez.dag.api.NamedEntityDescriptor 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)

Example 22 with NamedEntityDescriptor

use of org.apache.tez.dag.api.NamedEntityDescriptor in project tez by apache.

the class DAGAppMaster method processSchedulerDescriptors.

@VisibleForTesting
static void processSchedulerDescriptors(List<NamedEntityDescriptor> descriptors, boolean isLocal, UserPayload defaultPayload, BiMap<String, Integer> schedulerPluginMap) {
    if (isLocal) {
        boolean foundUberServiceName = false;
        for (NamedEntityDescriptor descriptor : descriptors) {
            if (descriptor.getEntityName().equals(TezConstants.getTezUberServicePluginName())) {
                foundUberServiceName = true;
                break;
            }
        }
        Preconditions.checkState(foundUberServiceName);
    } else {
        boolean foundYarn = false;
        for (int i = 0; i < descriptors.size(); i++) {
            if (descriptors.get(i).getEntityName().equals(TezConstants.getTezYarnServicePluginName())) {
                foundYarn = true;
            }
        }
        if (!foundYarn) {
            NamedEntityDescriptor yarnDescriptor = new NamedEntityDescriptor(TezConstants.getTezYarnServicePluginName(), null).setUserPayload(defaultPayload);
            addDescriptor(descriptors, schedulerPluginMap, yarnDescriptor);
        }
    }
}
Also used : NamedEntityDescriptor(org.apache.tez.dag.api.NamedEntityDescriptor) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

NamedEntityDescriptor (org.apache.tez.dag.api.NamedEntityDescriptor)22 Configuration (org.apache.hadoop.conf.Configuration)18 Test (org.junit.Test)17 UserPayload (org.apache.tez.dag.api.UserPayload)16 LinkedList (java.util.LinkedList)13 DagInfoImplForTest (org.apache.tez.dag.helpers.DagInfoImplForTest)12 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)11 ByteBuffer (java.nio.ByteBuffer)9 AppContext (org.apache.tez.dag.app.AppContext)6 TezDAGID (org.apache.tez.dag.records.TezDAGID)5 ByteString (com.google.protobuf.ByteString)4 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)4 EventHandler (org.apache.hadoop.yarn.event.EventHandler)4 TaskCommunicatorManagerInterface (org.apache.tez.dag.app.TaskCommunicatorManagerInterface)4 Container (org.apache.hadoop.yarn.api.records.Container)3 NodeId (org.apache.hadoop.yarn.api.records.NodeId)3 Event (org.apache.hadoop.yarn.event.Event)3 DAG (org.apache.tez.dag.app.dag.DAG)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 IOException (java.io.IOException)2