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 */ 018package org.apache.hadoop.yarn.api.records; 019 020import java.util.List; 021 022import org.apache.hadoop.classification.InterfaceAudience.Public; 023import org.apache.hadoop.classification.InterfaceStability.Stable; 024import org.apache.hadoop.yarn.api.ApplicationMasterProtocol; 025import org.apache.hadoop.yarn.util.Records; 026 027/** 028 * {@link ResourceBlacklistRequest} encapsulates the list of resource-names 029 * which should be added or removed from the <em>blacklist</em> of resources 030 * for the application. 031 * 032 * @see ResourceRequest 033 * @see ApplicationMasterProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest) 034 */ 035@Public 036@Stable 037public abstract class ResourceBlacklistRequest { 038 039 @Public 040 @Stable 041 public static ResourceBlacklistRequest newInstance( 042 List<String> additions, List<String> removals) { 043 ResourceBlacklistRequest blacklistRequest = 044 Records.newRecord(ResourceBlacklistRequest.class); 045 blacklistRequest.setBlacklistAdditions(additions); 046 blacklistRequest.setBlacklistRemovals(removals); 047 return blacklistRequest; 048 } 049 050 /** 051 * Get the list of resource-names which should be added to the 052 * application blacklist. 053 * 054 * @return list of resource-names which should be added to the 055 * application blacklist 056 */ 057 @Public 058 @Stable 059 public abstract List<String> getBlacklistAdditions(); 060 061 /** 062 * Set list of resource-names which should be added to the application blacklist. 063 * 064 * @param resourceNames list of resource-names which should be added to the 065 * application blacklist 066 */ 067 @Public 068 @Stable 069 public abstract void setBlacklistAdditions(List<String> resourceNames); 070 071 /** 072 * Get the list of resource-names which should be removed from the 073 * application blacklist. 074 * 075 * @return list of resource-names which should be removed from the 076 * application blacklist 077 */ 078 @Public 079 @Stable 080 public abstract List<String> getBlacklistRemovals(); 081 082 /** 083 * Set list of resource-names which should be removed from the 084 * application blacklist. 085 * 086 * @param resourceNames list of resource-names which should be removed from the 087 * application blacklist 088 */ 089 @Public 090 @Stable 091 public abstract void setBlacklistRemovals(List<String> resourceNames); 092 093}