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 java.util.List; 022import org.apache.hadoop.classification.InterfaceAudience.Public; 023import org.apache.hadoop.classification.InterfaceStability.Unstable; 024import org.apache.hadoop.yarn.api.ContainerManagementProtocol; 025import org.apache.hadoop.yarn.api.records.NMToken; 026import org.apache.hadoop.yarn.api.records.Token; 027import org.apache.hadoop.yarn.util.Records; 028 029/** 030 * <p>The request sent by <code>Application Master</code> to the 031 * <code>Node Manager</code> to change the resource quota of a container.</p> 032 * 033 * @see ContainerManagementProtocol#increaseContainersResource(IncreaseContainersResourceRequest) 034 */ 035@Public 036@Unstable 037public abstract class IncreaseContainersResourceRequest { 038 @Public 039 @Unstable 040 public static IncreaseContainersResourceRequest newInstance( 041 List<Token> containersToIncrease) { 042 IncreaseContainersResourceRequest request = 043 Records.newRecord(IncreaseContainersResourceRequest.class); 044 request.setContainersToIncrease(containersToIncrease); 045 return request; 046 } 047 048 /** 049 * Get a list of container tokens to be used for authorization during 050 * container resource increase. 051 * <p> 052 * Note: {@link NMToken} will be used for authenticating communication with 053 * {@code NodeManager}. 054 * @return the list of container tokens to be used for authorization during 055 * container resource increase. 056 * @see NMToken 057 */ 058 @Public 059 @Unstable 060 public abstract List<Token> getContainersToIncrease(); 061 062 /** 063 * Set container tokens to be used during container resource increase. 064 * The token is acquired from 065 * <code>AllocateResponse.getIncreasedContainers</code>. 066 * The token contains the container id and resource capability required for 067 * container resource increase. 068 * @param containersToIncrease the list of container tokens to be used 069 * for container resource increase. 070 */ 071 @Public 072 @Unstable 073 public abstract void setContainersToIncrease( 074 List<Token> containersToIncrease); 075}