Java Code Examples for org.apache.hadoop.yarn.api.records.ApplicationAttemptId#equals()

The following examples show how to use org.apache.hadoop.yarn.api.records.ApplicationAttemptId#equals() . 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: FSSchedulerNode.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void unreserveResource(
    SchedulerApplicationAttempt application) {
  // Cannot unreserve for wrong application...
  ApplicationAttemptId reservedApplication = 
      getReservedContainer().getContainer().getId().getApplicationAttemptId(); 
  if (!reservedApplication.equals(
      application.getApplicationAttemptId())) {
    throw new IllegalStateException("Trying to unreserve " +  
        " for application " + application.getApplicationId() + 
        " when currently reserved " + 
        " for application " + reservedApplication.getApplicationId() + 
        " on node " + this);
  }
  
  setReservedContainer(null);
  this.reservedAppSchedulable = null;
}
 
Example 2
Source File: FiCaSchedulerNode.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void unreserveResource(
    SchedulerApplicationAttempt application) {

  // adding NP checks as this can now be called for preemption
  if (getReservedContainer() != null
      && getReservedContainer().getContainer() != null
      && getReservedContainer().getContainer().getId() != null
      && getReservedContainer().getContainer().getId()
        .getApplicationAttemptId() != null) {

    // Cannot unreserve for wrong application...
    ApplicationAttemptId reservedApplication =
        getReservedContainer().getContainer().getId()
          .getApplicationAttemptId();
    if (!reservedApplication.equals(
        application.getApplicationAttemptId())) {
      throw new IllegalStateException("Trying to unreserve " +
          " for application " + application.getApplicationAttemptId() +
          " when currently reserved " +
          " for application " + reservedApplication.getApplicationId() +
          " on node " + this);
    }
  }
  setReservedContainer(null);
}
 
Example 3
Source File: FSSchedulerNode.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void unreserveResource(
    SchedulerApplicationAttempt application) {
  // Cannot unreserve for wrong application...
  ApplicationAttemptId reservedApplication = 
      getReservedContainer().getContainer().getId().getApplicationAttemptId(); 
  if (!reservedApplication.equals(
      application.getApplicationAttemptId())) {
    throw new IllegalStateException("Trying to unreserve " +  
        " for application " + application.getApplicationId() + 
        " when currently reserved " + 
        " for application " + reservedApplication.getApplicationId() + 
        " on node " + this);
  }
  
  setReservedContainer(null);
  this.reservedAppSchedulable = null;
}
 
Example 4
Source File: FiCaSchedulerNode.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void unreserveResource(
    SchedulerApplicationAttempt application) {

  // adding NP checks as this can now be called for preemption
  if (getReservedContainer() != null
      && getReservedContainer().getContainer() != null
      && getReservedContainer().getContainer().getId() != null
      && getReservedContainer().getContainer().getId()
        .getApplicationAttemptId() != null) {

    // Cannot unreserve for wrong application...
    ApplicationAttemptId reservedApplication =
        getReservedContainer().getContainer().getId()
          .getApplicationAttemptId();
    if (!reservedApplication.equals(
        application.getApplicationAttemptId())) {
      throw new IllegalStateException("Trying to unreserve " +
          " for application " + application.getApplicationAttemptId() +
          " when currently reserved " +
          " for application " + reservedApplication.getApplicationId() +
          " on node " + this);
    }
  }
  setReservedContainer(null);
}
 
Example 5
Source File: RMServerUtils.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * It will validate to make sure all the containers belong to correct
 * application attempt id. If not then it will throw
 * {@link InvalidContainerReleaseException}
 * 
 * @param containerReleaseList
 *          containers to be released as requested by application master.
 * @param appAttemptId
 *          Application attempt Id
 * @throws InvalidContainerReleaseException
 */
public static void
    validateContainerReleaseRequest(List<ContainerId> containerReleaseList,
        ApplicationAttemptId appAttemptId)
        throws InvalidContainerReleaseException {
  for (ContainerId cId : containerReleaseList) {
    if (!appAttemptId.equals(cId.getApplicationAttemptId())) {
      throw new InvalidContainerReleaseException(
          "Cannot release container : "
              + cId.toString()
              + " not belonging to this application attempt : "
              + appAttemptId);
    }
  }
}
 
Example 6
Source File: LeveldbRMStateStore.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private ApplicationAttemptStateData createAttemptState(String itemName,
    byte[] data) throws IOException {
  ApplicationAttemptId attemptId =
      ConverterUtils.toApplicationAttemptId(itemName);
  ApplicationAttemptStateDataPBImpl attemptState =
      new ApplicationAttemptStateDataPBImpl(
          ApplicationAttemptStateDataProto.parseFrom(data));
  if (!attemptId.equals(attemptState.getAttemptId())) {
    throw new YarnRuntimeException("The database entry for " + attemptId
        + " contains data for " + attemptState.getAttemptId());
  }
  return attemptState;
}
 
Example 7
Source File: RMServerUtils.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * It will validate to make sure all the containers belong to correct
 * application attempt id. If not then it will throw
 * {@link InvalidContainerReleaseException}
 * 
 * @param containerReleaseList
 *          containers to be released as requested by application master.
 * @param appAttemptId
 *          Application attempt Id
 * @throws InvalidContainerReleaseException
 */
public static void
    validateContainerReleaseRequest(List<ContainerId> containerReleaseList,
        ApplicationAttemptId appAttemptId)
        throws InvalidContainerReleaseException {
  for (ContainerId cId : containerReleaseList) {
    if (!appAttemptId.equals(cId.getApplicationAttemptId())) {
      throw new InvalidContainerReleaseException(
          "Cannot release container : "
              + cId.toString()
              + " not belonging to this application attempt : "
              + appAttemptId);
    }
  }
}
 
Example 8
Source File: LeveldbRMStateStore.java    From big-c with Apache License 2.0 5 votes vote down vote up
private ApplicationAttemptStateData createAttemptState(String itemName,
    byte[] data) throws IOException {
  ApplicationAttemptId attemptId =
      ConverterUtils.toApplicationAttemptId(itemName);
  ApplicationAttemptStateDataPBImpl attemptState =
      new ApplicationAttemptStateDataPBImpl(
          ApplicationAttemptStateDataProto.parseFrom(data));
  if (!attemptId.equals(attemptState.getAttemptId())) {
    throw new YarnRuntimeException("The database entry for " + attemptId
        + " contains data for " + attemptState.getAttemptId());
  }
  return attemptState;
}