本文整理汇总了Java中org.apache.tez.dag.api.VertexLocationHint.create方法的典型用法代码示例。如果您正苦于以下问题:Java VertexLocationHint.create方法的具体用法?Java VertexLocationHint.create怎么用?Java VertexLocationHint.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tez.dag.api.VertexLocationHint
的用法示例。
在下文中一共展示了VertexLocationHint.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logVertexConfigurationDoneEvent
import org.apache.tez.dag.api.VertexLocationHint; //导入方法依赖的package包/类
void logVertexConfigurationDoneEvent() {
if (recoveryData == null || !recoveryData.shouldSkipInit()) {
Map<String, EdgeProperty> sourceEdgeProperties = new HashMap<String, EdgeProperty>();
for (Map.Entry<Vertex, Edge> entry : this.sourceVertices.entrySet()) {
sourceEdgeProperties.put(entry.getKey().getName(), entry.getValue().getEdgeProperty());
}
VertexConfigurationDoneEvent reconfigureDoneEvent =
new VertexConfigurationDoneEvent(vertexId, clock.getTime(),
numTasks, taskLocationHints == null ? null : VertexLocationHint.create(Lists.newArrayList(taskLocationHints)),
sourceEdgeProperties, rootInputSpecs, setParallelismCalledFlag);
this.appContext.getHistoryHandler().handle(
new DAGHistoryEvent(getDAGId(), reconfigureDoneEvent));
}
}
示例2: VertexWrapper
import org.apache.tez.dag.api.VertexLocationHint; //导入方法依赖的package包/类
VertexWrapper(AppContext appContext, VertexPlan vertexPlan, Configuration conf,
boolean checkVertexOnlyConf) {
if (appContext == null) {
mockAppContext = createDefaultMockAppContext();
DAG mockDag = mock(DAG.class);
doReturn(new Credentials()).when(mockDag).getCredentials();
doReturn(mockDag).when(mockAppContext).getCurrentDAG();
} else {
mockAppContext = appContext;
}
Configuration dagConf = new Configuration(false);
dagConf.set("abc1", "xyz1");
dagConf.set("foo1", "bar1");
this.vertexPlan = vertexPlan;
vertex =
new VertexImpl(TezVertexID.fromString("vertex_1418197758681_0001_1_00"), vertexPlan,
"testvertex", conf, mock(EventHandler.class), mock(TaskCommunicatorManagerInterface.class),
mock(Clock.class), mock(TaskHeartbeatHandler.class), false, mockAppContext,
VertexLocationHint.create(new LinkedList<TaskLocationHint>()), null,
new TaskSpecificLaunchCmdOption(conf), mock(StateChangeNotifier.class),
dagConf);
if (checkVertexOnlyConf) {
Assert.assertEquals("xyz1", vertex.vertexOnlyConf.get("abc1"));
Assert.assertEquals("bar2", vertex.vertexOnlyConf.get("foo1"));
Assert.assertEquals("bar", vertex.vertexOnlyConf.get("foo"));
}
}
示例3: testVertexReconfigureDoneEvent
import org.apache.tez.dag.api.VertexLocationHint; //导入方法依赖的package包/类
private void testVertexReconfigureDoneEvent() throws Exception {
VertexLocationHint vertexLocationHint = VertexLocationHint.create(new ArrayList<TaskLocationHint>());
InputSpecUpdate rootInputSpecUpdateBulk = InputSpecUpdate
.createAllTaskInputSpecUpdate(2);
InputSpecUpdate rootInputSpecUpdatePerTask = InputSpecUpdate
.createPerTaskInputSpecUpdate(Lists.newArrayList(1, 2, 3));
Map<String, InputSpecUpdate> rootInputSpecUpdates = new HashMap<String, InputSpecUpdate>();
rootInputSpecUpdates.put("input1", rootInputSpecUpdateBulk);
rootInputSpecUpdates.put("input2", rootInputSpecUpdatePerTask);
Map<String, EdgeProperty> sourceEdgeManagers
= new HashMap<String, EdgeProperty>();
// add standard and custom edge
sourceEdgeManagers.put("foo", EdgeProperty.create(DataMovementType.SCATTER_GATHER,
DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
OutputDescriptor.create("Out1"), InputDescriptor.create("in1")));
sourceEdgeManagers.put("foo1", EdgeProperty.create(EdgeManagerPluginDescriptor.create("bar1")
.setUserPayload(
UserPayload.create(ByteBuffer.wrap(new String("payload").getBytes()), 100)),
DataSourceType.PERSISTED, SchedulingType.SEQUENTIAL,
OutputDescriptor.create("Out1"), InputDescriptor.create("in1")));
final long reconfigureDoneTime = 100;
final int numTasks = 2;
VertexConfigurationDoneEvent event =
new VertexConfigurationDoneEvent(
TezVertexID.getInstance(
TezDAGID.getInstance(ApplicationId.newInstance(0, 1), 1), 111),
reconfigureDoneTime, numTasks, vertexLocationHint, sourceEdgeManagers,
rootInputSpecUpdates, true);
Assert.assertEquals(numTasks, event.getNumTasks());
Assert.assertEquals(reconfigureDoneTime, event.getReconfigureDoneTime());
VertexConfigurationDoneEvent deserializedEvent = (VertexConfigurationDoneEvent)
testProtoConversion(event);
Assert.assertEquals(event.getVertexID(), deserializedEvent.getVertexID());
Assert.assertEquals(event.getNumTasks(), deserializedEvent.getNumTasks());
Assert.assertEquals(event.isSetParallelismCalled(), deserializedEvent.isSetParallelismCalled());
// vertexLocationHint
Assert.assertEquals(event.getVertexLocationHint(),
deserializedEvent.getVertexLocationHint());
// rootInputSpec
Assert.assertEquals(event.getRootInputSpecUpdates().size(), deserializedEvent
.getRootInputSpecUpdates().size());
InputSpecUpdate deserializedBulk = deserializedEvent.getRootInputSpecUpdates().get("input1");
InputSpecUpdate deserializedPerTask = deserializedEvent.getRootInputSpecUpdates().get("input2");
Assert.assertEquals(rootInputSpecUpdateBulk.isForAllWorkUnits(),
deserializedBulk.isForAllWorkUnits());
Assert.assertEquals(rootInputSpecUpdateBulk.getAllNumPhysicalInputs(),
deserializedBulk.getAllNumPhysicalInputs());
Assert.assertEquals(rootInputSpecUpdatePerTask.isForAllWorkUnits(),
deserializedPerTask.isForAllWorkUnits());
Assert.assertEquals(rootInputSpecUpdatePerTask.getAllNumPhysicalInputs(),
deserializedPerTask.getAllNumPhysicalInputs());
// sourceEdgeManager
Assert.assertEquals(event.getSourceEdgeProperties().size(), deserializedEvent
.getSourceEdgeProperties().size());
Assert.assertEquals(event.getSourceEdgeProperties().get("foo").getDataMovementType(),
deserializedEvent.getSourceEdgeProperties().get("foo").getDataMovementType());
Assert.assertNull(deserializedEvent.getSourceEdgeProperties().get("foo")
.getEdgeManagerDescriptor());
Assert.assertEquals(event.getSourceEdgeProperties().get("foo1").getDataMovementType(),
deserializedEvent.getSourceEdgeProperties().get("foo1").getDataMovementType());
Assert.assertEquals(event.getSourceEdgeProperties().get("foo1").getEdgeManagerDescriptor()
.getUserPayload().getVersion(), deserializedEvent.getSourceEdgeProperties().get("foo1")
.getEdgeManagerDescriptor().getUserPayload().getVersion());
Assert.assertArrayEquals(event.getSourceEdgeProperties().get("foo1")
.getEdgeManagerDescriptor().getUserPayload().deepCopyAsArray(), deserializedEvent
.getSourceEdgeProperties().get("foo1").getEdgeManagerDescriptor().getUserPayload()
.deepCopyAsArray());
logEvents(event, deserializedEvent);
}