001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.yarn.api.protocolrecords;
020
021import org.apache.hadoop.classification.InterfaceAudience.Private;
022import org.apache.hadoop.classification.InterfaceAudience.Public;
023import org.apache.hadoop.classification.InterfaceStability.Stable;
024import org.apache.hadoop.classification.InterfaceStability.Unstable;
025import org.apache.hadoop.yarn.api.AMRMProtocol;
026import org.apache.hadoop.yarn.api.records.AMResponse;
027import org.apache.hadoop.yarn.api.records.Container;
028
029/**
030 * <p>The response sent by the <code>ResourceManager</code> the  
031 * <code>ApplicationMaster</code> during resource negotiation.</p>
032 *
033 * <p>The response, via {@link AMResponse}, includes:
034 *   <ul>
035 *     <li>Response ID to track duplicate responses.</li>
036 *     <li>
037 *       A reboot flag to let the <code>ApplicationMaster</code> know that its 
038 *       horribly out of sync and needs to reboot.</li>
039 *     <li>A list of newly allocated {@link Container}.</li>
040 *     <li>A list of completed {@link Container}.</li>
041 *     <li>
042 *       The available headroom for resources in the cluster for the
043 *       application. 
044 *     </li>
045 *   </ul>
046 * </p>
047 * 
048 * @see AMRMProtocol#allocate(AllocateRequest)
049 */
050@Public
051@Stable
052public interface AllocateResponse {
053  /**
054   * Get the {@link AMResponse} sent by the <code>ResourceManager</code>.
055   * @return <code>AMResponse</code> sent by the <code>ResourceManager</code>
056   */
057  @Public
058  @Stable
059  public abstract AMResponse getAMResponse();
060
061  @Private
062  @Unstable
063  public abstract void setAMResponse(AMResponse amResponse);
064  
065  
066  /**
067   * Get the number of hosts available on the cluster.
068   * @return the available host count.
069   */
070  @Public
071  @Stable
072  public int getNumClusterNodes();
073  
074  @Private
075  @Unstable
076  public void setNumClusterNodes(int numNodes);
077}