Java Code Examples for org.apache.hadoop.yarn.api.records.ContainerId#CONTAINER_ID_BITMASK

The following examples show how to use org.apache.hadoop.yarn.api.records.ContainerId#CONTAINER_ID_BITMASK . 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: AppLogAggregatorImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private boolean shouldUploadLogs(ContainerId containerId,
    boolean wasContainerSuccessful) {

  // All containers
  if (this.retentionPolicy
      .equals(ContainerLogsRetentionPolicy.ALL_CONTAINERS)) {
    return true;
  }

  // AM Container only
  if (this.retentionPolicy
      .equals(ContainerLogsRetentionPolicy.APPLICATION_MASTER_ONLY)) {
    if ((containerId.getContainerId()
        & ContainerId.CONTAINER_ID_BITMASK)== 1) {
      return true;
    }
    return false;
  }

  // AM + Failing containers
  if (this.retentionPolicy
      .equals(ContainerLogsRetentionPolicy.AM_AND_FAILED_CONTAINERS_ONLY)) {
    if ((containerId.getContainerId()
        & ContainerId.CONTAINER_ID_BITMASK) == 1) {
      return true;
    } else if(!wasContainerSuccessful) {
      return true;
    }
    return false;
  }
  return false;
}
 
Example 2
Source File: AppLogAggregatorImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private boolean shouldUploadLogs(ContainerId containerId,
    boolean wasContainerSuccessful) {

  // All containers
  if (this.retentionPolicy
      .equals(ContainerLogsRetentionPolicy.ALL_CONTAINERS)) {
    return true;
  }

  // AM Container only
  if (this.retentionPolicy
      .equals(ContainerLogsRetentionPolicy.APPLICATION_MASTER_ONLY)) {
    if ((containerId.getContainerId()
        & ContainerId.CONTAINER_ID_BITMASK)== 1) {
      return true;
    }
    return false;
  }

  // AM + Failing containers
  if (this.retentionPolicy
      .equals(ContainerLogsRetentionPolicy.AM_AND_FAILED_CONTAINERS_ONLY)) {
    if ((containerId.getContainerId()
        & ContainerId.CONTAINER_ID_BITMASK) == 1) {
      return true;
    } else if(!wasContainerSuccessful) {
      return true;
    }
    return false;
  }
  return false;
}