當前位置: 首頁>>代碼示例>>Java>>正文


Java Container.getId方法代碼示例

本文整理匯總了Java中org.apache.hadoop.yarn.api.records.Container.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getId方法的具體用法?Java Container.getId怎麽用?Java Container.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.yarn.api.records.Container的用法示例。


在下文中一共展示了Container.getId方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RMContainerImpl

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
public RMContainerImpl(Container container,
    ApplicationAttemptId appAttemptId, NodeId nodeId,
    String user, RMContext rmContext, long creationTime) {
  this.stateMachine = stateMachineFactory.make(this);
  this.containerId = container.getId();
  this.nodeId = nodeId;
  this.container = container;
  this.appAttemptId = appAttemptId;
  this.user = user;
  this.creationTime = creationTime;
  this.rmContext = rmContext;
  this.eventHandler = rmContext.getDispatcher().getEventHandler();
  this.containerAllocationExpirer = rmContext.getContainerAllocationExpirer();
  this.isAMContainer = false;
  this.resourceRequests = null;

  ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
  this.readLock = lock.readLock();
  this.writeLock = lock.writeLock();

  rmContext.getRMApplicationHistoryWriter().containerStarted(this);
  rmContext.getSystemMetricsPublisher().containerCreated(
      this, this.creationTime);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:25,代碼來源:RMContainerImpl.java

示例2: storeAttempt

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
protected ContainerId storeAttempt(RMStateStore store,
    ApplicationAttemptId attemptId,
    String containerIdStr, Token<AMRMTokenIdentifier> appToken,
    SecretKey clientTokenMasterKey, TestDispatcher dispatcher)
    throws Exception {

  RMAppAttemptMetrics mockRmAppAttemptMetrics = 
      mock(RMAppAttemptMetrics.class);
  Container container = new ContainerPBImpl();
  container.setId(ConverterUtils.toContainerId(containerIdStr));
  RMAppAttempt mockAttempt = mock(RMAppAttempt.class);
  when(mockAttempt.getAppAttemptId()).thenReturn(attemptId);
  when(mockAttempt.getMasterContainer()).thenReturn(container);
  when(mockAttempt.getAMRMToken()).thenReturn(appToken);
  when(mockAttempt.getClientTokenMasterKey())
      .thenReturn(clientTokenMasterKey);
  when(mockAttempt.getRMAppAttemptMetrics())
      .thenReturn(mockRmAppAttemptMetrics);
  when(mockRmAppAttemptMetrics.getAggregateAppResourceUsage())
      .thenReturn(new AggregateAppResourceUsage(0, 0, 0));
  dispatcher.attemptId = attemptId;
  store.storeNewApplicationAttempt(mockAttempt);
  waitNotify(dispatcher);
  return container.getId();
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:26,代碼來源:RMStateStoreTestBase.java

示例3: addNewContainer

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
/**
 * launch a new container with the given life time
 */
public void addNewContainer(Container container, long lifeTimeMS) {
  LOG.debug(MessageFormat.format("NodeManager {0} launches a new " +
          "container ({1}).", node.getNodeID(), container.getId()));
  if (lifeTimeMS != -1) {
    // normal container
    ContainerSimulator cs = new ContainerSimulator(container.getId(),
            container.getResource(), lifeTimeMS + System.currentTimeMillis(),
            lifeTimeMS);
    containerQueue.add(cs);
    runningContainers.put(cs.getId(), cs);
  } else {
    // AM container
    // -1 means AMContainer
    synchronized(amContainerList) {
      amContainerList.add(container.getId());
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:22,代碼來源:NMSimulator.java

示例4: ContainerRemoteLaunchEvent

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
/**
 * Create a ContainerRemoteLaunchEvent
 * @param taskId task which the container is allocated to
 * @param containerLaunchContext container launch context
 * @param allocatedContainer container need to launch
 */
public ContainerRemoteLaunchEvent(Id taskId, ContainerLaunchContext containerLaunchContext,
    Container allocatedContainer) {
  super(taskId, allocatedContainer.getId(), StringInterner.weakIntern(allocatedContainer
      .getNodeId().toString()), allocatedContainer.getContainerToken(),
      ContainerLauncherEventType.CONTAINER_REMOTE_LAUNCH);
  this.allocatedContainer = allocatedContainer;
  this.containerLaunchContext = containerLaunchContext;
}
 
開發者ID:Tencent,項目名稱:angel,代碼行數:15,代碼來源:ContainerRemoteLaunchEvent.java

示例5: containerCompleted

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
synchronized public void containerCompleted(RMContainer rmContainer,
    ContainerStatus containerStatus, RMContainerEventType event) {
  
  Container container = rmContainer.getContainer();
  ContainerId containerId = container.getId();
  
  // Remove from the list of newly allocated containers if found
  newlyAllocatedContainers.remove(rmContainer);
  
  // Inform the container
  rmContainer.handle(
      new RMContainerFinishedEvent(
          containerId,
          containerStatus, 
          event)
      );
  LOG.info("Completed container: " + rmContainer.getContainerId() + 
      " in state: " + rmContainer.getState() + " event:" + event);
  
  // Remove from the list of containers
  liveContainers.remove(rmContainer.getContainerId());

  RMAuditLogger.logSuccess(getUser(), 
      AuditConstants.RELEASE_CONTAINER, "SchedulerApp", 
      getApplicationId(), containerId);
  
  // Update usage metrics 
  Resource containerResource = rmContainer.getContainer().getResource();
  queue.getMetrics().releaseResources(getUser(), 1, containerResource);
  this.attemptResourceUsage.decUsed(containerResource);

  // remove from preemption map if it is completed
  preemptionMap.remove(rmContainer);

  // Clear resource utilization metrics cache.
  lastMemoryAggregateAllocationUpdateTime = -1;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:38,代碼來源:FSAppAttempt.java

示例6: StartContainerEvent

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
public StartContainerEvent(Container container,
    ContainerLaunchContext containerLaunchContext) {
  super(container.getId(), container.getNodeId(),
      container.getContainerToken(), ContainerEventType.START_CONTAINER);
  this.container = container;
  this.containerLaunchContext = containerLaunchContext;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:8,代碼來源:NMClientAsyncImpl.java

示例7: ContainerRemoteLaunchEvent

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
public ContainerRemoteLaunchEvent(TaskAttemptId taskAttemptID,
    ContainerLaunchContext containerLaunchContext,
    Container allocatedContainer, Task remoteTask) {
  super(taskAttemptID, allocatedContainer.getId(), StringInterner
    .weakIntern(allocatedContainer.getNodeId().toString()),
    allocatedContainer.getContainerToken(),
    ContainerLauncher.EventType.CONTAINER_REMOTE_LAUNCH);
  this.allocatedContainer = allocatedContainer;
  this.containerLaunchContext = containerLaunchContext;
  this.task = remoteTask;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:12,代碼來源:ContainerRemoteLaunchEvent.java

示例8: get

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
ContainerId get(TaskAttemptId tId) {
  Container taskContainer;
  if (tId.getTaskId().getTaskType().equals(TaskType.MAP)) {
    taskContainer = maps.get(tId);
  } else {
    taskContainer = reduces.get(tId);
  }

  if (taskContainer == null) {
    return null;
  } else {
    return taskContainer.getId();
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:15,代碼來源:RMContainerAllocator.java

示例9: containerCompleted

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
synchronized public boolean containerCompleted(RMContainer rmContainer,
    ContainerStatus containerStatus, RMContainerEventType event,
    String partition) {

  // Remove from the list of containers
  if (null == liveContainers.remove(rmContainer.getContainerId())) {
    return false;
  }
  
  // Remove from the list of newly allocated containers if found
  newlyAllocatedContainers.remove(rmContainer);

  Container container = rmContainer.getContainer();
  ContainerId containerId = container.getId();

  // Inform the container
  rmContainer.handle(
      new RMContainerFinishedEvent(
          containerId,
          containerStatus, 
          event)
      );
  LOG.info("Completed container: " + rmContainer.getContainerId() + 
      " in state: " + rmContainer.getState() + " event:" + event);

  containersToPreempt.remove(rmContainer.getContainerId());

  RMAuditLogger.logSuccess(getUser(),
      AuditConstants.RELEASE_CONTAINER, "SchedulerApp",
      getApplicationId(), containerId);
  
  // Update usage metrics 
  Resource containerResource = rmContainer.getContainer().getResource();
  queue.getMetrics().releaseResources(getUser(), 1, containerResource);
  attemptResourceUsage.decUsed(partition, containerResource);

  // Clear resource utilization metrics cache.
  lastMemoryAggregateAllocationUpdateTime = -1;

  return true;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:42,代碼來源:FiCaSchedulerApp.java

示例10: createStartedContainer

import org.apache.hadoop.yarn.api.records.Container; //導入方法依賴的package包/類
protected synchronized StartedContainer createStartedContainer(
    Container container) throws YarnException, IOException {
  StartedContainer startedContainer = new StartedContainer(container.getId(),
      container.getNodeId(), container.getContainerToken());
  return startedContainer;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:7,代碼來源:NMClientImpl.java


注:本文中的org.apache.hadoop.yarn.api.records.Container.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。