Java Code Examples for org.apache.hadoop.yarn.api.records.ContainerStatus#setContainerId()

The following examples show how to use org.apache.hadoop.yarn.api.records.ContainerStatus#setContainerId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestRPC.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: TestRPC.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 3
Source File: BuilderUtils.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: TestYarnServerApiClasses.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private ContainerStatus getContainerStatus(int applicationId,
    int containerID, int appAttemptId) {
  ContainerStatus status = recordFactory
      .newRecordInstance(ContainerStatus.class);
  status.setContainerId(getContainerId(containerID, appAttemptId));
  return status;
}
 
Example 5
Source File: SchedulerUtils.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: NMSimulator.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: BuilderUtils.java    From big-c with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: TestYarnServerApiClasses.java    From big-c with Apache License 2.0 5 votes vote down vote up
private ContainerStatus getContainerStatus(int applicationId,
    int containerID, int appAttemptId) {
  ContainerStatus status = recordFactory
      .newRecordInstance(ContainerStatus.class);
  status.setContainerId(getContainerId(containerID, appAttemptId));
  return status;
}
 
Example 9
Source File: SchedulerUtils.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 10
Source File: NMSimulator.java    From big-c with Apache License 2.0 5 votes vote down vote up
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;
}