Search in sources :

Example 1 with VertexPlan

use of org.apache.tez.dag.api.records.DAGProtos.VertexPlan in project tez by apache.

the class TestVertexImpl method testVertexWithNoTasks.

@Test(timeout = 5000)
public void testVertexWithNoTasks() {
    TezVertexID vId = null;
    try {
        TezDAGID invalidDagId = TezDAGID.getInstance(dagId.getApplicationId(), 1000);
        vId = TezVertexID.getInstance(invalidDagId, 1);
        VertexPlan vPlan = invalidDagPlan.getVertex(0);
        VertexImpl v = new VertexImpl(vId, vPlan, vPlan.getName(), conf, dispatcher.getEventHandler(), taskCommunicatorManagerInterface, clock, thh, true, appContext, vertexLocationHint, null, taskSpecificLaunchCmdOption, updateTracker, new Configuration(false));
        v.setInputVertices(new HashMap());
        vertexIdMap.put(vId, v);
        vertices.put(v.getName(), v);
        v.handle(new VertexEvent(vId, VertexEventType.V_INIT));
        dispatcher.await();
        Assert.assertEquals(VertexState.INITED, v.getState());
        Assert.assertTrue(0.0f == v.getCompletedTaskProgress());
        v.handle(new VertexEvent(vId, VertexEventType.V_START));
        dispatcher.await();
        Assert.assertEquals(VertexState.SUCCEEDED, v.getState());
        Assert.assertTrue(1.0f == v.getCompletedTaskProgress());
    } finally {
        if (vId != null) {
            vertexIdMap.remove(vId);
        }
    }
}
Also used : VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan) PlanTaskConfiguration(org.apache.tez.dag.api.records.DAGProtos.PlanTaskConfiguration) Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) HashMap(java.util.HashMap) TezDAGID(org.apache.tez.dag.records.TezDAGID) VertexEvent(org.apache.tez.dag.app.dag.event.VertexEvent) TezVertexID(org.apache.tez.dag.records.TezVertexID) VertexManagerPluginForTest(org.apache.tez.test.VertexManagerPluginForTest) Test(org.junit.Test) GraceShuffleVertexManagerForTest(org.apache.tez.test.GraceShuffleVertexManagerForTest) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest) EdgeManagerForTest(org.apache.tez.test.EdgeManagerForTest)

Example 2 with VertexPlan

use of org.apache.tez.dag.api.records.DAGProtos.VertexPlan in project tez by apache.

the class TestVertexImpl method createSamplerDAGPlan.

// Create a plan with 3 vertices: A, B, C
// A -> B, A -> C, B -> C
private DAGPlan createSamplerDAGPlan(boolean customEdge) {
    LOG.info("Setting up dag plan");
    VertexPlan.Builder vCBuilder = VertexPlan.newBuilder();
    vCBuilder.setName("C").setType(PlanVertexType.NORMAL).setProcessorDescriptor(TezEntityDescriptorProto.newBuilder().setClassName("C.class")).addTaskLocationHint(PlanTaskLocationHint.newBuilder().addHost("host3").addRack("rack3").build()).setTaskConfig(PlanTaskConfiguration.newBuilder().setNumTasks(customEdge ? -1 : 2).setVirtualCores(4).setMemoryMb(1024).setJavaOpts("foo").setTaskModule("x3.y3").build()).setVertexManagerPlugin(TezEntityDescriptorProto.newBuilder().setClassName(VertexManagerPluginForTest.class.getName())).addInEdgeId("A_C").addInEdgeId("B_C");
    if (customEdge) {
        vCBuilder.setVertexManagerPlugin(TezEntityDescriptorProto.newBuilder().setClassName(VertexManagerPluginForTest.class.getName()));
    }
    VertexPlan vCPlan = vCBuilder.build();
    DAGPlan dag = DAGPlan.newBuilder().setName("TestSamplerDAG").addVertex(VertexPlan.newBuilder().setName("A").setProcessorDescriptor(TezEntityDescriptorProto.newBuilder().setClassName("A.class")).setType(PlanVertexType.NORMAL).addTaskLocationHint(PlanTaskLocationHint.newBuilder().addHost("host1").addRack("rack1").build()).setTaskConfig(PlanTaskConfiguration.newBuilder().setNumTasks(1).setVirtualCores(4).setMemoryMb(1024).setJavaOpts("").setTaskModule("A.class").build()).addOutEdgeId("A_B").addOutEdgeId("A_C").build()).addVertex(VertexPlan.newBuilder().setName("B").setProcessorDescriptor(TezEntityDescriptorProto.newBuilder().setClassName("B.class")).setType(PlanVertexType.NORMAL).addTaskLocationHint(PlanTaskLocationHint.newBuilder().addHost("host2").addRack("rack2").build()).setTaskConfig(PlanTaskConfiguration.newBuilder().setNumTasks(2).setVirtualCores(4).setMemoryMb(1024).setJavaOpts("").setTaskModule("").build()).addInEdgeId("A_B").addOutEdgeId("B_C").build()).addVertex(vCPlan).addEdge(EdgePlan.newBuilder().setEdgeDestination(TezEntityDescriptorProto.newBuilder().setClassName("A_B.class")).setInputVertexName("A").setEdgeSource(TezEntityDescriptorProto.newBuilder().setClassName("A_B.class")).setOutputVertexName("B").setDataMovementType(PlanEdgeDataMovementType.BROADCAST).setId("A_B").setDataSourceType(PlanEdgeDataSourceType.PERSISTED).setSchedulingType(PlanEdgeSchedulingType.SEQUENTIAL).build()).addEdge(EdgePlan.newBuilder().setEdgeDestination(TezEntityDescriptorProto.newBuilder().setClassName("A_C")).setInputVertexName("A").setEdgeSource(TezEntityDescriptorProto.newBuilder().setClassName("A_C.class")).setOutputVertexName("C").setDataMovementType(customEdge ? PlanEdgeDataMovementType.CUSTOM : PlanEdgeDataMovementType.SCATTER_GATHER).setId("A_C").setDataSourceType(PlanEdgeDataSourceType.PERSISTED).setSchedulingType(PlanEdgeSchedulingType.SEQUENTIAL).build()).addEdge(EdgePlan.newBuilder().setEdgeDestination(TezEntityDescriptorProto.newBuilder().setClassName("B_C.class")).setInputVertexName("B").setEdgeSource(TezEntityDescriptorProto.newBuilder().setClassName("B_C.class")).setOutputVertexName("C").setDataMovementType(customEdge ? PlanEdgeDataMovementType.CUSTOM : PlanEdgeDataMovementType.SCATTER_GATHER).setId("B_C").setDataSourceType(PlanEdgeDataSourceType.PERSISTED).setSchedulingType(PlanEdgeSchedulingType.SEQUENTIAL).build()).build();
    return dag;
}
Also used : VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan) DAGPlan(org.apache.tez.dag.api.records.DAGProtos.DAGPlan)

Example 3 with VertexPlan

use of org.apache.tez.dag.api.records.DAGProtos.VertexPlan in project tez by apache.

the class TestVertexImpl method testVertexNoTasksTerminated.

@Test(timeout = 10000)
public void testVertexNoTasksTerminated() {
    TezVertexID vId = null;
    try {
        TezDAGID invalidDagId = TezDAGID.getInstance(dagId.getApplicationId(), 1000);
        vId = TezVertexID.getInstance(invalidDagId, 1);
        VertexPlan vPlan = invalidDagPlan.getVertex(0);
        EventHandler mockEventHandler = mock(EventHandler.class);
        VertexImpl v = new VertexImpl(vId, vPlan, vPlan.getName(), conf, mockEventHandler, taskCommunicatorManagerInterface, clock, thh, true, appContext, vertexLocationHint, null, taskSpecificLaunchCmdOption, updateTracker, new Configuration(false));
        v.setInputVertices(new HashMap());
        vertexIdMap.put(vId, v);
        vertices.put(v.getName(), v);
        v.handle(new VertexEvent(vId, VertexEventType.V_INIT));
        Assert.assertEquals(VertexState.INITED, v.getState());
        v.handle(new VertexEvent(vId, VertexEventType.V_START));
        Assert.assertEquals(VertexState.RUNNING, v.getState());
        v.handle(new VertexEventTermination(vId, VertexTerminationCause.OTHER_VERTEX_FAILURE));
        Assert.assertEquals(VertexState.TERMINATING, v.getState());
        v.handle(new VertexEvent(vId, VertexEventType.V_COMPLETED));
        Assert.assertEquals(VertexState.KILLED, v.getState());
        Assert.assertTrue(1.0f == v.getCompletedTaskProgress());
    } finally {
        if (vId != null) {
            vertexIdMap.remove(vId);
        }
    }
}
Also used : VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan) PlanTaskConfiguration(org.apache.tez.dag.api.records.DAGProtos.PlanTaskConfiguration) Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) HashMap(java.util.HashMap) VertexEventTermination(org.apache.tez.dag.app.dag.event.VertexEventTermination) TezDAGID(org.apache.tez.dag.records.TezDAGID) EventHandler(org.apache.hadoop.yarn.event.EventHandler) HistoryEventHandler(org.apache.tez.dag.history.HistoryEventHandler) VertexEvent(org.apache.tez.dag.app.dag.event.VertexEvent) TezVertexID(org.apache.tez.dag.records.TezVertexID) VertexManagerPluginForTest(org.apache.tez.test.VertexManagerPluginForTest) Test(org.junit.Test) GraceShuffleVertexManagerForTest(org.apache.tez.test.GraceShuffleVertexManagerForTest) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest) EdgeManagerForTest(org.apache.tez.test.EdgeManagerForTest)

Example 4 with VertexPlan

use of org.apache.tez.dag.api.records.DAGProtos.VertexPlan in project tez by apache.

the class TestVertexImpl2 method createVertexWrapperForExecutionContextTest.

private VertexWrapper createVertexWrapperForExecutionContextTest(ExecutionContextTestInfoHolder vertexInfo) {
    VertexPlan vertexPlan = createVertexPlanForExeuctionContextTests(vertexInfo);
    VertexWrapper vertexWrapper = new VertexWrapper(vertexInfo.appContext, vertexPlan, new Configuration(false), true);
    return vertexWrapper;
}
Also used : VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration)

Example 5 with VertexPlan

use of org.apache.tez.dag.api.records.DAGProtos.VertexPlan in project tez by apache.

the class TestVertexImpl2 method createVertexWrapperForLogTests.

private VertexWrapper createVertexWrapperForLogTests(LogTestInfoHolder logTestInfoHolder, Configuration conf) {
    VertexPlan vertexPlan = createVertexPlanForLogTests(logTestInfoHolder);
    VertexWrapper vertexWrapper = new VertexWrapper(vertexPlan, conf);
    return vertexWrapper;
}
Also used : VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan)

Aggregations

VertexPlan (org.apache.tez.dag.api.records.DAGProtos.VertexPlan)17 HashMap (java.util.HashMap)7 DAGPlan (org.apache.tez.dag.api.records.DAGProtos.DAGPlan)6 Test (org.junit.Test)6 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)5 Configuration (org.apache.hadoop.conf.Configuration)4 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)4 EdgePlan (org.apache.tez.dag.api.records.DAGProtos.EdgePlan)4 PlanTaskConfiguration (org.apache.tez.dag.api.records.DAGProtos.PlanTaskConfiguration)4 TezVertexID (org.apache.tez.dag.records.TezVertexID)4 VertexLocationHint (org.apache.tez.dag.api.VertexLocationHint)3 ByteString (com.google.protobuf.ByteString)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 URISyntaxException (java.net.URISyntaxException)2 UnknownHostException (java.net.UnknownHostException)2 ServiceStateException (org.apache.hadoop.service.ServiceStateException)2 TaskLocationHint (org.apache.tez.dag.api.TaskLocationHint)2 TezException (org.apache.tez.dag.api.TezException)2 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)2