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


Java ContainerStatus.setState方法代碼示例

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


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

示例1: startContainers

import org.apache.hadoop.yarn.api.records.ContainerStatus; //導入方法依賴的package包/類
@Override
public StartContainersResponse startContainers(
    StartContainersRequest requests) throws YarnException {
  StartContainersResponse response =
      recordFactory.newRecordInstance(StartContainersResponse.class);
  for (StartContainerRequest request : requests.getStartContainerRequests()) {
    Token containerToken = request.getContainerToken();
    ContainerTokenIdentifier tokenId = null;

    try {
      tokenId = newContainerTokenIdentifier(containerToken);
    } catch (IOException e) {
      throw RPCUtil.getRemoteException(e);
    }
    ContainerStatus status =
        recordFactory.newRecordInstance(ContainerStatus.class);
    status.setState(ContainerState.RUNNING);
    status.setContainerId(tokenId.getContainerID());
    status.setExitStatus(0);
    statuses.add(status);

  }
  return response;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:25,代碼來源:TestRPC.java

示例2: newContainerStatus

import org.apache.hadoop.yarn.api.records.ContainerStatus; //導入方法依賴的package包/類
public static ContainerStatus newContainerStatus(ContainerId containerId,
    ContainerState containerState, String diagnostics, int exitStatus) {
  ContainerStatus containerStatus = recordFactory
    .newRecordInstance(ContainerStatus.class);
  containerStatus.setState(containerState);
  containerStatus.setContainerId(containerId);
  containerStatus.setDiagnostics(diagnostics);
  containerStatus.setExitStatus(exitStatus);
  return containerStatus;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:11,代碼來源:BuilderUtils.java

示例3: cloneAndGetContainerStatus

import org.apache.hadoop.yarn.api.records.ContainerStatus; //導入方法依賴的package包/類
@Override
public ContainerStatus cloneAndGetContainerStatus() {
  ContainerStatus containerStatus = recordFactory
      .newRecordInstance(ContainerStatus.class);
  containerStatus
      .setState(org.apache.hadoop.yarn.api.records.ContainerState.RUNNING);
  containerStatus.setDiagnostics("testing");
  containerStatus.setExitStatus(0);
  return containerStatus;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:11,代碼來源:MockContainer.java

示例4: createAbnormalContainerStatus

import org.apache.hadoop.yarn.api.records.ContainerStatus; //導入方法依賴的package包/類
/**
 * Utility to create a {@link ContainerStatus} during exceptional
 * circumstances.
 * 
 * @param containerId {@link ContainerId} of returned/released/lost container.
 * @param diagnostics diagnostic message
 * @return <code>ContainerStatus</code> for an returned/released/lost 
 *         container
 */
private static ContainerStatus createAbnormalContainerStatus(
    ContainerId containerId, int exitStatus, String diagnostics) {
  ContainerStatus containerStatus = 
      recordFactory.newRecordInstance(ContainerStatus.class);
  containerStatus.setContainerId(containerId);
  containerStatus.setDiagnostics(diagnostics);
  containerStatus.setExitStatus(exitStatus);
  containerStatus.setState(ContainerState.COMPLETE);
  return containerStatus;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:SchedulerUtils.java

示例5: newContainerStatus

import org.apache.hadoop.yarn.api.records.ContainerStatus; //導入方法依賴的package包/類
private ContainerStatus newContainerStatus(ContainerId cId, 
                                           ContainerState state,
                                           int exitState) {
  ContainerStatus cs = Records.newRecord(ContainerStatus.class);
  cs.setContainerId(cId);
  cs.setState(state);
  cs.setExitStatus(exitState);
  return cs;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:NMSimulator.java

示例6: stopContainers

import org.apache.hadoop.yarn.api.records.ContainerStatus; //導入方法依賴的package包/類
@Override
synchronized public StopContainersResponse stopContainers(StopContainersRequest request) 
throws YarnException {
  for (ContainerId containerID : request.getContainerIds()) {
    String applicationId =
        String.valueOf(containerID.getApplicationAttemptId()
          .getApplicationId().getId());
    // Mark the container as COMPLETE
    List<Container> applicationContainers = containers.get(containerID.getApplicationAttemptId()
            .getApplicationId());
    for (Container c : applicationContainers) {
      if (c.getId().compareTo(containerID) == 0) {
        ContainerStatus containerStatus = containerStatusMap.get(c);
        containerStatus.setState(ContainerState.COMPLETE);
        containerStatusMap.put(c, containerStatus);
      }
    }

    // Send a heartbeat
    try {
      heartbeat();
    } catch (IOException ioe) {
      throw RPCUtil.getRemoteException(ioe);
    }

    // Remove container and update status
    int ctr = 0;
    Container container = null;
    for (Iterator<Container> i = applicationContainers.iterator(); i
      .hasNext();) {
      container = i.next();
      if (container.getId().compareTo(containerID) == 0) {
        i.remove();
        ++ctr;
      }
    }

    if (ctr != 1) {
      throw new IllegalStateException("Container " + containerID
          + " stopped " + ctr + " times!");
    }

    Resources.addTo(available, container.getResource());
    Resources.subtractFrom(used, container.getResource());

    if (LOG.isDebugEnabled()) {
      LOG.debug("stopContainer:" + " node=" + containerManagerAddress
          + " application=" + applicationId + " container=" + containerID
          + " available=" + available + " used=" + used);
    }
  }
  return StopContainersResponse.newInstance(null,null);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:54,代碼來源:NodeManager.java


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