Java Code Examples for org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer#getReservedNode()

The following examples show how to use org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer#getReservedNode() . 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 5 votes vote down vote up
@Override
public synchronized void reserveResource(
    SchedulerApplicationAttempt application, Priority priority,
    RMContainer container) {
  // Check if it's already reserved
  RMContainer reservedContainer = getReservedContainer();
  if (reservedContainer != null) {
    // Sanity check
    if (!container.getContainer().getNodeId().equals(getNodeID())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container +
          " on node " + container.getReservedNode() + 
          " when currently" + " reserved resource " + reservedContainer +
          " on node " + reservedContainer.getReservedNode());
    }
    
    // Cannot reserve more than one application on a given node!
    if (!reservedContainer.getContainer().getId().getApplicationAttemptId()
        .equals(container.getContainer().getId().getApplicationAttemptId())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container + 
          " for application " + application.getApplicationId() + 
          " when currently" +
          " reserved container " + reservedContainer +
          " on node " + this);
    }

    LOG.info("Updated reserved container " + 
        container.getContainer().getId() + " on node " + 
        this + " for application " + application);
  } else {
    LOG.info("Reserved container " + container.getContainer().getId() + 
        " on node " + this + " for application " + application);
  }
  setReservedContainer(container);
  this.reservedAppSchedulable = (FSAppAttempt) application;
}
 
Example 2
Source File: FSSchedulerNode.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void reserveResource(
    SchedulerApplicationAttempt application, Priority priority,
    RMContainer container) {
  // Check if it's already reserved
  RMContainer reservedContainer = getReservedContainer();
  if (reservedContainer != null) {
    // Sanity check
    if (!container.getContainer().getNodeId().equals(getNodeID())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container +
          " on node " + container.getReservedNode() + 
          " when currently" + " reserved resource " + reservedContainer +
          " on node " + reservedContainer.getReservedNode());
    }
    
    // Cannot reserve more than one application on a given node!
    if (!reservedContainer.getContainer().getId().getApplicationAttemptId()
        .equals(container.getContainer().getId().getApplicationAttemptId())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container + 
          " for application " + application.getApplicationId() + 
          " when currently" +
          " reserved container " + reservedContainer +
          " on node " + this);
    }

    LOG.info("Updated reserved container " + 
        container.getContainer().getId() + " on node " + 
        this + " for application " + application);
  } else {
    LOG.info("Reserved container " + container.getContainer().getId() + 
        " on node " + this + " for application " + application);
  }
  setReservedContainer(container);
  this.reservedAppSchedulable = (FSAppAttempt) application;
}
 
Example 3
Source File: FiCaSchedulerNode.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void reserveResource(
    SchedulerApplicationAttempt application, Priority priority,
    RMContainer container) {
  // Check if it's already reserved
  RMContainer reservedContainer = getReservedContainer();
  if (reservedContainer != null) {
    // Sanity check
    if (!container.getContainer().getNodeId().equals(getNodeID())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container +
          " on node " + container.getReservedNode() + 
          " when currently" + " reserved resource " + reservedContainer +
          " on node " + reservedContainer.getReservedNode());
    }
    
    // Cannot reserve more than one application attempt on a given node!
    // Reservation is still against attempt.
    if (!reservedContainer.getContainer().getId().getApplicationAttemptId()
        .equals(container.getContainer().getId().getApplicationAttemptId())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container + 
          " for application " + application.getApplicationAttemptId() + 
          " when currently" +
          " reserved container " + reservedContainer +
          " on node " + this);
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("Updated reserved container "
          + container.getContainer().getId() + " on node " + this
          + " for application attempt "
          + application.getApplicationAttemptId());
    }
  } else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Reserved container "
          + container.getContainer().getId() + " on node " + this
          + " for application attempt "
          + application.getApplicationAttemptId());
    }
  }
  setReservedContainer(container);
}
 
Example 4
Source File: FiCaSchedulerNode.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized void reserveResource(
    SchedulerApplicationAttempt application, Priority priority,
    RMContainer container) {
  // Check if it's already reserved
  RMContainer reservedContainer = getReservedContainer();
  if (reservedContainer != null) {
    // Sanity check
    if (!container.getContainer().getNodeId().equals(getNodeID())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container +
          " on node " + container.getReservedNode() + 
          " when currently" + " reserved resource " + reservedContainer +
          " on node " + reservedContainer.getReservedNode());
    }
    
    // Cannot reserve more than one application attempt on a given node!
    // Reservation is still against attempt.
    if (!reservedContainer.getContainer().getId().getApplicationAttemptId()
        .equals(container.getContainer().getId().getApplicationAttemptId())) {
      throw new IllegalStateException("Trying to reserve" +
          " container " + container + 
          " for application " + application.getApplicationAttemptId() + 
          " when currently" +
          " reserved container " + reservedContainer +
          " on node " + this);
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("Updated reserved container "
          + container.getContainer().getId() + " on node " + this
          + " for application attempt "
          + application.getApplicationAttemptId());
    }
  } else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Reserved container "
          + container.getContainer().getId() + " on node " + this
          + " for application attempt "
          + application.getApplicationAttemptId());
    }
  }
  setReservedContainer(container);
}