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());
}
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);
}
}
}
Aggregations