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