当前位置: 首页>>代码示例>>Java>>正文


Java VertexLocationHint.create方法代码示例

本文整理汇总了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));
  }
}
 
开发者ID:apache,项目名称:tez,代码行数:15,代码来源:VertexImpl.java

示例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"));
  }

}
 
开发者ID:apache,项目名称:tez,代码行数:33,代码来源:TestVertexImpl2.java

示例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);
}
 
开发者ID:apache,项目名称:tez,代码行数:73,代码来源:TestHistoryEventsProtoConversion.java


注:本文中的org.apache.tez.dag.api.VertexLocationHint.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。