Search in sources :

Example 1 with PlanTaskConfiguration

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

the class TestDAGVerify method testDAGCreateDataInference.

@Test(timeout = 5000)
public void testDAGCreateDataInference() {
    Vertex v1 = Vertex.create("v1", ProcessorDescriptor.create(dummyProcessorClassName));
    Map<String, LocalResource> lrs1 = Maps.newHashMap();
    String lrName1 = "LR1";
    lrs1.put(lrName1, LocalResource.newInstance(URL.newInstance("file", "localhost", 0, "/test"), LocalResourceType.FILE, LocalResourceVisibility.PUBLIC, 1, 1));
    Map<String, LocalResource> lrs2 = Maps.newHashMap();
    String lrName2 = "LR2";
    lrs2.put(lrName2, LocalResource.newInstance(URL.newInstance("file", "localhost", 0, "/test1"), LocalResourceType.FILE, LocalResourceVisibility.PUBLIC, 1, 1));
    Set<String> hosts = Sets.newHashSet();
    hosts.add("h1");
    hosts.add("h2");
    List<TaskLocationHint> taskLocationHints = Lists.newLinkedList();
    taskLocationHints.add(TaskLocationHint.createTaskLocationHint(hosts, null));
    taskLocationHints.add(TaskLocationHint.createTaskLocationHint(hosts, null));
    VertexLocationHint vLoc = VertexLocationHint.create(taskLocationHints);
    DataSourceDescriptor ds = DataSourceDescriptor.create(InputDescriptor.create("I.class"), InputInitializerDescriptor.create(dummyInputInitClassName), dummyTaskCount, null, vLoc, lrs2);
    v1.addDataSource("i1", ds);
    DAG dag = DAG.create("testDag");
    dag.addVertex(v1);
    dag.addTaskLocalFiles(lrs1);
    DAGPlan dagPlan = dag.createDag(new TezConfiguration(), null, null, null, true);
    Assert.assertEquals(lrName1, dagPlan.getLocalResource(0).getName());
    VertexPlan vPlan = dagPlan.getVertex(0);
    PlanTaskConfiguration taskPlan = vPlan.getTaskConfig();
    Assert.assertEquals(dummyTaskCount, taskPlan.getNumTasks());
    Assert.assertEquals(TezConfiguration.TEZ_TASK_RESOURCE_MEMORY_MB_DEFAULT, taskPlan.getMemoryMb());
    Assert.assertEquals(lrName2, taskPlan.getLocalResource(0).getName());
    Assert.assertEquals(dummyTaskCount, vPlan.getTaskLocationHintCount());
}
Also used : PlanTaskConfiguration(org.apache.tez.dag.api.records.DAGProtos.PlanTaskConfiguration) LocalResource(org.apache.hadoop.yarn.api.records.LocalResource) DAGPlan(org.apache.tez.dag.api.records.DAGProtos.DAGPlan) VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan) Test(org.junit.Test)

Aggregations

LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)1 DAGPlan (org.apache.tez.dag.api.records.DAGProtos.DAGPlan)1 PlanTaskConfiguration (org.apache.tez.dag.api.records.DAGProtos.PlanTaskConfiguration)1 VertexPlan (org.apache.tez.dag.api.records.DAGProtos.VertexPlan)1 Test (org.junit.Test)1