當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。