当前位置: 首页>>代码示例>>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;未经允许,请勿转载。