use of org.apache.tez.dag.api.Vertex.VertexExecutionContext in project tez by apache.
the class TestVertexImpl2 method testVertexExecutionContextOverride.
@Test(timeout = 5000)
public void testVertexExecutionContextOverride() {
VertexExecutionContext defaultExecContext = VertexExecutionContext.create(ExecutionContextTestInfoHolder.append(ExecutionContextTestInfoHolder.TASK_SCHEDULER_NAME_BASE, 0), ExecutionContextTestInfoHolder.append(ExecutionContextTestInfoHolder.CONTAINER_LAUNCHER_NAME_BASE, 2), ExecutionContextTestInfoHolder.append(ExecutionContextTestInfoHolder.TASK_COMM_NAME_BASE, 2));
VertexExecutionContext vertexExecutionContext = VertexExecutionContext.create(ExecutionContextTestInfoHolder.append(ExecutionContextTestInfoHolder.TASK_SCHEDULER_NAME_BASE, 1), ExecutionContextTestInfoHolder.append(ExecutionContextTestInfoHolder.CONTAINER_LAUNCHER_NAME_BASE, 1), ExecutionContextTestInfoHolder.append(ExecutionContextTestInfoHolder.TASK_COMM_NAME_BASE, 1));
ExecutionContextTestInfoHolder info = new ExecutionContextTestInfoHolder(vertexExecutionContext, defaultExecContext, 3);
VertexWrapper vertexWrapper = createVertexWrapperForExecutionContextTest(info);
assertEquals(1, vertexWrapper.vertex.taskSchedulerIdentifier);
assertEquals(1, vertexWrapper.vertex.containerLauncherIdentifier);
assertEquals(1, vertexWrapper.vertex.taskCommunicatorIdentifier);
}
use of org.apache.tez.dag.api.Vertex.VertexExecutionContext in project tez by apache.
the class TestDAGPlan method testServiceDescriptorPropagation.
@Test(timeout = 5000)
public void testServiceDescriptorPropagation() {
DAG dag = DAG.create("testDag");
ProcessorDescriptor pd1 = ProcessorDescriptor.create("processor1").setUserPayload(UserPayload.create(ByteBuffer.wrap("processor1Bytes".getBytes())));
ProcessorDescriptor pd2 = ProcessorDescriptor.create("processor2").setUserPayload(UserPayload.create(ByteBuffer.wrap("processor2Bytes".getBytes())));
VertexExecutionContext defaultExecutionContext = VertexExecutionContext.create("plugin", "plugin", "plugin");
VertexExecutionContext v1Context = VertexExecutionContext.createExecuteInAm(true);
ServicePluginsDescriptor servicePluginsDescriptor = ServicePluginsDescriptor.create(true, new TaskSchedulerDescriptor[] { TaskSchedulerDescriptor.create("plugin", null) }, new ContainerLauncherDescriptor[] { ContainerLauncherDescriptor.create("plugin", null) }, new TaskCommunicatorDescriptor[] { TaskCommunicatorDescriptor.create("plugin", null) });
Vertex v1 = Vertex.create("v1", pd1, 10, Resource.newInstance(1024, 1)).setExecutionContext(v1Context);
Vertex v2 = Vertex.create("v2", pd2, 1, Resource.newInstance(1024, 1));
v1.setTaskLaunchCmdOpts("").setTaskEnvironment(new HashMap<String, String>()).addTaskLocalFiles(new HashMap<String, LocalResource>());
v2.setTaskLaunchCmdOpts("").setTaskEnvironment(new HashMap<String, String>()).addTaskLocalFiles(new HashMap<String, LocalResource>());
InputDescriptor inputDescriptor = InputDescriptor.create("input").setUserPayload(UserPayload.create(ByteBuffer.wrap("inputBytes".getBytes())));
OutputDescriptor outputDescriptor = OutputDescriptor.create("output").setUserPayload(UserPayload.create(ByteBuffer.wrap("outputBytes".getBytes())));
Edge edge = Edge.create(v1, v2, EdgeProperty.create(DataMovementType.SCATTER_GATHER, DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL, outputDescriptor, inputDescriptor));
dag.addVertex(v1).addVertex(v2).addEdge(edge);
dag.setExecutionContext(defaultExecutionContext);
DAGPlan dagProto = dag.createDag(new TezConfiguration(), null, null, null, true, servicePluginsDescriptor, null);
assertEquals(2, dagProto.getVertexCount());
assertEquals(1, dagProto.getEdgeCount());
assertTrue(dagProto.hasDefaultExecutionContext());
VertexExecutionContextProto defaultContextProto = dagProto.getDefaultExecutionContext();
assertFalse(defaultContextProto.getExecuteInContainers());
assertFalse(defaultContextProto.getExecuteInAm());
assertEquals("plugin", defaultContextProto.getTaskSchedulerName());
assertEquals("plugin", defaultContextProto.getContainerLauncherName());
assertEquals("plugin", defaultContextProto.getTaskCommName());
VertexPlan v1Proto = dagProto.getVertex(0);
assertTrue(v1Proto.hasExecutionContext());
VertexExecutionContextProto v1ContextProto = v1Proto.getExecutionContext();
assertFalse(v1ContextProto.getExecuteInContainers());
assertTrue(v1ContextProto.getExecuteInAm());
assertFalse(v1ContextProto.hasTaskSchedulerName());
assertFalse(v1ContextProto.hasContainerLauncherName());
assertFalse(v1ContextProto.hasTaskCommName());
VertexPlan v2Proto = dagProto.getVertex(1);
assertFalse(v2Proto.hasExecutionContext());
}
Aggregations