Search in sources :

Example 1 with CompositeEventRouteMetadata

use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata 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));
}
Also used : CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata) EventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata) CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata)

Example 2 with CompositeEventRouteMetadata

use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata 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));
}
Also used : CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata) EventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata) CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata)

Example 3 with CompositeEventRouteMetadata

use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata 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));
}
Also used : CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata) EventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata) CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata)

Example 4 with CompositeEventRouteMetadata

use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata 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));
}
Also used : CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata) EventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata) CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata)

Example 5 with CompositeEventRouteMetadata

use of org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata 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));
}
Also used : CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata) EventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata) CompositeEventRouteMetadata(org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata)

Aggregations

CompositeEventRouteMetadata (org.apache.tez.dag.api.EdgeManagerPluginOnDemand.CompositeEventRouteMetadata)9 EventRouteMetadata (org.apache.tez.dag.api.EdgeManagerPluginOnDemand.EventRouteMetadata)9 EdgeManagerPluginOnDemand (org.apache.tez.dag.api.EdgeManagerPluginOnDemand)1 TezException (org.apache.tez.dag.api.TezException)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1 CompositeDataMovementEvent (org.apache.tez.runtime.api.events.CompositeDataMovementEvent)1 CompositeRoutedDataMovementEvent (org.apache.tez.runtime.api.events.CompositeRoutedDataMovementEvent)1 DataMovementEvent (org.apache.tez.runtime.api.events.DataMovementEvent)1 InputFailedEvent (org.apache.tez.runtime.api.events.InputFailedEvent)1 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)1