use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata in project tez by apache.
the class TestCartesianProductEdgeManagerPartitioned method testTwoWayV1.
private void testTwoWayV1(CartesianProductConfigProto config) throws Exception {
when(mockContext.getSourceVertexName()).thenReturn("v1");
when(mockContext.getSourceVertexNumTasks()).thenReturn(3);
edgeManager.initialize(config);
CompositeEventRouteMetadata compositeRoutingData = edgeManager.routeCompositeDataMovementEventToDestination(1, 1);
assertNotNull(compositeRoutingData);
assertEquals(1, compositeRoutingData.getCount());
assertEquals(1, compositeRoutingData.getSource());
assertEquals(1, compositeRoutingData.getTarget());
EventRouteMetadata routingData = edgeManager.routeInputSourceTaskFailedEventToDestination(1, 1);
assertNotNull(routingData);
assertEquals(1, routingData.getNumEvents());
assertArrayEquals(new int[] { 1 }, routingData.getTargetIndices());
assertEquals(2, edgeManager.routeInputErrorEventToSource(1, 2));
assertEquals(12, edgeManager.getNumDestinationConsumerTasks(1));
assertEquals(3, edgeManager.getNumDestinationTaskPhysicalInputs(10));
assertEquals(4, edgeManager.getNumSourceTaskPhysicalOutputs(2));
}
use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata in project tez by apache.
the class TestFairCartesianProductEdgeManager method testEdgeManager.
private void testEdgeManager(CartesianProductConfigProto conf, String vName, int numTask, String groupName, TestData cDMEInvalid, TestData cDMEValid, TestData srcFailInvalid, TestData srcFailValid, TestData inputError, TestData numDestInput, TestData numSrcOutputTest, TestData numConsumerTest) throws Exception {
when(mockContext.getSourceVertexName()).thenReturn(vName);
when(mockContext.getSourceVertexNumTasks()).thenReturn(numTask);
when(mockContext.getVertexGroupName()).thenReturn(groupName);
edgeManager.initialize(conf);
CompositeEventRouteMetadata cDME;
if (cDMEInvalid != null) {
cDME = edgeManager.routeCompositeDataMovementEventToDestination(cDMEInvalid.srcId, cDMEInvalid.destId);
assertNull(cDME);
}
cDME = edgeManager.routeCompositeDataMovementEventToDestination(cDMEValid.srcId, cDMEValid.destId);
assertNotNull(cDME);
CompositeEventRouteMetadata expectedCDME = (CompositeEventRouteMetadata) (cDMEValid.expected);
assertEquals(expectedCDME.getCount(), cDME.getCount());
assertEquals(expectedCDME.getTarget(), cDME.getTarget());
assertEquals(expectedCDME.getSource(), cDME.getSource());
EventRouteMetadata dme;
if (srcFailInvalid != null) {
dme = edgeManager.routeInputSourceTaskFailedEventToDestination(srcFailInvalid.srcId, srcFailInvalid.destId);
assertNull(dme);
}
dme = edgeManager.routeInputSourceTaskFailedEventToDestination(srcFailValid.srcId, srcFailValid.destId);
assertNotNull(dme);
EventRouteMetadata expectedDME = (EventRouteMetadata) (srcFailValid.expected);
assertEquals(expectedDME.getNumEvents(), dme.getNumEvents());
assertArrayEquals(expectedDME.getTargetIndices(), dme.getTargetIndices());
assertEquals(inputError.expected, edgeManager.routeInputErrorEventToSource(inputError.destId, inputError.inputId));
assertEquals(numDestInput.expected, edgeManager.getNumDestinationTaskPhysicalInputs(numDestInput.destId));
assertEquals(numSrcOutputTest.expected, edgeManager.getNumSourceTaskPhysicalOutputs(numSrcOutputTest.srcId));
assertEquals(numConsumerTest.expected, edgeManager.getNumDestinationConsumerTasks(numConsumerTest.srcId));
}
use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata in project tez by apache.
the class TestCartesianProductEdgeManagerPartitioned method testThreeWayV2.
private void testThreeWayV2(CartesianProductConfigProto config) throws Exception {
when(mockContext.getSourceVertexName()).thenReturn("v2");
when(mockContext.getSourceVertexNumTasks()).thenReturn(4);
edgeManager.initialize(config);
CompositeEventRouteMetadata compositeRoutingData = edgeManager.routeCompositeDataMovementEventToDestination(1, 1);
assertNotNull(compositeRoutingData);
assertEquals(1, compositeRoutingData.getCount());
assertEquals(1, compositeRoutingData.getSource());
assertEquals(1, compositeRoutingData.getTarget());
EventRouteMetadata routingData = edgeManager.routeInputSourceTaskFailedEventToDestination(1, 1);
assertNotNull(routingData);
assertEquals(1, routingData.getNumEvents());
assertArrayEquals(new int[] { 1 }, routingData.getTargetIndices());
assertEquals(2, edgeManager.routeInputErrorEventToSource(1, 2));
assertEquals(24, edgeManager.getNumDestinationConsumerTasks(1));
assertEquals(4, edgeManager.getNumDestinationTaskPhysicalInputs(10));
assertEquals(2, edgeManager.getNumSourceTaskPhysicalOutputs(2));
}
use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata in project tez by apache.
the class TestCartesianProductEdgeManagerPartitioned method testTwoWayV1WithFilter.
private void testTwoWayV1WithFilter(CartesianProductConfigProto config) throws Exception {
when(mockContext.getSourceVertexName()).thenReturn("v1");
when(mockContext.getSourceVertexNumTasks()).thenReturn(3);
edgeManager.initialize(config);
CompositeEventRouteMetadata compositeRoutingData = edgeManager.routeCompositeDataMovementEventToDestination(1, 1);
assertNotNull(compositeRoutingData);
assertEquals(1, compositeRoutingData.getCount());
assertEquals(0, compositeRoutingData.getSource());
assertEquals(1, compositeRoutingData.getTarget());
EventRouteMetadata routingData = edgeManager.routeInputSourceTaskFailedEventToDestination(1, 1);
assertNotNull(routingData);
assertEquals(1, routingData.getNumEvents());
assertArrayEquals(new int[] { 1 }, routingData.getTargetIndices());
assertEquals(2, edgeManager.routeInputErrorEventToSource(1, 2));
assertEquals(3, edgeManager.getNumDestinationConsumerTasks(1));
assertEquals(3, edgeManager.getNumDestinationTaskPhysicalInputs(10));
assertEquals(4, edgeManager.getNumSourceTaskPhysicalOutputs(2));
}
use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata in project tez by apache.
the class TestCartesianProductEdgeManagerPartitioned method testTwoWayV0WithFilter.
private void testTwoWayV0WithFilter(CartesianProductConfigProto config) throws Exception {
when(mockContext.getSourceVertexName()).thenReturn("v0");
when(mockContext.getSourceVertexNumTasks()).thenReturn(2);
edgeManager.initialize(config);
CompositeEventRouteMetadata compositeRoutingData = edgeManager.routeCompositeDataMovementEventToDestination(1, 1);
assertNotNull(compositeRoutingData);
assertEquals(1, compositeRoutingData.getCount());
assertEquals(2, compositeRoutingData.getSource());
assertEquals(1, compositeRoutingData.getTarget());
EventRouteMetadata routingData = edgeManager.routeInputSourceTaskFailedEventToDestination(1, 1);
assertNotNull(routingData);
assertEquals(1, routingData.getNumEvents());
assertArrayEquals(new int[] { 1 }, routingData.getTargetIndices());
assertEquals(1, edgeManager.routeInputErrorEventToSource(1, 1));
assertEquals(3, edgeManager.getNumDestinationConsumerTasks(1));
assertEquals(2, edgeManager.getNumDestinationTaskPhysicalInputs(1));
assertEquals(3, edgeManager.getNumSourceTaskPhysicalOutputs(2));
}
Aggregations