use of org.apache.tez.dag.api.records.DAGProtos.AMPluginDescriptorProto in project tez by apache.
the class TestDagTypeConverters method testServiceDescriptorTranslation.
@Test(timeout = 5000)
public void testServiceDescriptorTranslation() {
TaskSchedulerDescriptor[] taskSchedulers;
ContainerLauncherDescriptor[] containerLaunchers;
TaskCommunicatorDescriptor[] taskComms;
ServicePluginsDescriptor servicePluginsDescriptor;
AMPluginDescriptorProto proto;
// Uber-execution
servicePluginsDescriptor = ServicePluginsDescriptor.create(true);
proto = DagTypeConverters.convertServicePluginDescriptorToProto(servicePluginsDescriptor);
assertTrue(proto.hasUberEnabled());
assertTrue(proto.hasContainersEnabled());
assertTrue(proto.getUberEnabled());
assertTrue(proto.getContainersEnabled());
assertEquals(0, proto.getTaskSchedulersCount());
assertEquals(0, proto.getContainerLaunchersCount());
assertEquals(0, proto.getTaskCommunicatorsCount());
// Single plugin set specified. One with a payload.
taskSchedulers = createTaskScheduelrs(1, false);
containerLaunchers = createContainerLaunchers(1, false);
taskComms = createTaskCommunicators(1, true);
servicePluginsDescriptor = ServicePluginsDescriptor.create(taskSchedulers, containerLaunchers, taskComms);
proto = DagTypeConverters.convertServicePluginDescriptorToProto(servicePluginsDescriptor);
assertTrue(proto.hasUberEnabled());
assertTrue(proto.hasContainersEnabled());
assertFalse(proto.getUberEnabled());
assertTrue(proto.getContainersEnabled());
verifyPlugins(proto.getTaskSchedulersList(), 1, testScheduler, false);
verifyPlugins(proto.getContainerLaunchersList(), 1, testLauncher, false);
verifyPlugins(proto.getTaskCommunicatorsList(), 1, testComm, true);
// Multiple plugin set specified. All with a payload
taskSchedulers = createTaskScheduelrs(3, true);
containerLaunchers = createContainerLaunchers(3, true);
taskComms = createTaskCommunicators(3, true);
servicePluginsDescriptor = ServicePluginsDescriptor.create(taskSchedulers, containerLaunchers, taskComms);
proto = DagTypeConverters.convertServicePluginDescriptorToProto(servicePluginsDescriptor);
assertTrue(proto.hasUberEnabled());
assertTrue(proto.hasContainersEnabled());
assertFalse(proto.getUberEnabled());
assertTrue(proto.getContainersEnabled());
verifyPlugins(proto.getTaskSchedulersList(), 3, testScheduler, true);
verifyPlugins(proto.getContainerLaunchersList(), 3, testLauncher, true);
verifyPlugins(proto.getTaskCommunicatorsList(), 3, testComm, true);
// Single plugin set specified. One with a payload. No container execution. Uber enabled.
taskSchedulers = createTaskScheduelrs(1, false);
containerLaunchers = createContainerLaunchers(1, false);
taskComms = createTaskCommunicators(1, true);
servicePluginsDescriptor = ServicePluginsDescriptor.create(false, true, taskSchedulers, containerLaunchers, taskComms);
proto = DagTypeConverters.convertServicePluginDescriptorToProto(servicePluginsDescriptor);
assertTrue(proto.hasUberEnabled());
assertTrue(proto.hasContainersEnabled());
assertTrue(proto.getUberEnabled());
assertFalse(proto.getContainersEnabled());
verifyPlugins(proto.getTaskSchedulersList(), 1, testScheduler, false);
verifyPlugins(proto.getContainerLaunchersList(), 1, testLauncher, false);
verifyPlugins(proto.getTaskCommunicatorsList(), 1, testComm, true);
}
Aggregations