YARN-912. Move client facing exceptions to yarn-api module. Contributed by Mayank Bansal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1504032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-07-17 07:31:33 +00:00
parent 8b9c1e68ab
commit c6facfb10d
16 changed files with 159 additions and 72 deletions

View File

@ -49,6 +49,9 @@ Release 2.1.1-beta - UNRELEASED
IMPROVEMENTS IMPROVEMENTS
YARN-912. Move client facing exceptions to yarn-api module. (Mayank Bansal
via vinodkv)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -53,6 +53,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.api.records.NodeReport; import org.apache.hadoop.yarn.api.records.NodeReport;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.api.records.Token; import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.api.records.YarnClusterMetrics; import org.apache.hadoop.yarn.api.records.YarnClusterMetrics;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
@ -113,6 +114,9 @@ public interface ApplicationClientProtocol {
* @return (empty) response on accepting the submission * @return (empty) response on accepting the submission
* @throws YarnException * @throws YarnException
* @throws IOException * @throws IOException
* @throws InvalidResourceRequestException
* The exception is thrown when a {@link ResourceRequest} is out of
* the range of the configured lower and upper resource boundaries.
* @see #getNewApplication(GetNewApplicationRequest) * @see #getNewApplication(GetNewApplicationRequest)
*/ */
@Public @Public

View File

@ -30,8 +30,11 @@ import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterReque
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse; import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
import org.apache.hadoop.yarn.exceptions.YarnException;
/** /**
* <p>The protocol between a live instance of <code>ApplicationMaster</code> * <p>The protocol between a live instance of <code>ApplicationMaster</code>
@ -44,23 +47,33 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
@Public @Public
@Stable @Stable
public interface ApplicationMasterProtocol { public interface ApplicationMasterProtocol {
/** /**
* <p>The interface used by a new <code>ApplicationMaster</code> to register * <p>
* with the <code>ResourceManager</code>.</p> * The interface used by a new <code>ApplicationMaster</code> to register with
* the <code>ResourceManager</code>.
* </p>
* *
* <p>The <code>ApplicationMaster</code> needs to provide details such * <p>
* as RPC Port, HTTP tracking url etc. as specified in * The <code>ApplicationMaster</code> needs to provide details such as RPC
* {@link RegisterApplicationMasterRequest}.</p> * Port, HTTP tracking url etc. as specified in
* {@link RegisterApplicationMasterRequest}.
* </p>
* *
* <p>The <code>ResourceManager</code> responds with critical details such * <p>
* as maximum resource capabilities in the cluster as specified in * The <code>ResourceManager</code> responds with critical details such as
* {@link RegisterApplicationMasterResponse}.</p> * maximum resource capabilities in the cluster as specified in
* * {@link RegisterApplicationMasterResponse}.
* @param request registration request * </p>
*
* @param request
* registration request
* @return registration respose * @return registration respose
* @throws YarnException * @throws YarnException
* @throws IOException * @throws IOException
* @throws InvalidApplicationMasterRequestException
* The exception is thrown when an ApplicationMaster tries to
* register more then once.
* @see RegisterApplicationMasterRequest * @see RegisterApplicationMasterRequest
* @see RegisterApplicationMasterResponse * @see RegisterApplicationMasterResponse
*/ */
@ -93,36 +106,57 @@ public interface ApplicationMasterProtocol {
public FinishApplicationMasterResponse finishApplicationMaster( public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) FinishApplicationMasterRequest request)
throws YarnException, IOException; throws YarnException, IOException;
/** /**
* <p>The main interface between an <code>ApplicationMaster</code> * <p>
* and the <code>ResourceManager</code>.</p> * The main interface between an <code>ApplicationMaster</code> and the
* <code>ResourceManager</code>.
* </p>
* *
* <p>The <code>ApplicationMaster</code> uses this interface to provide a list * <p>
* of {@link ResourceRequest} and returns unused {@link Container} allocated * The <code>ApplicationMaster</code> uses this interface to provide a list of
* to it via {@link AllocateRequest}. Optionally, the * {@link ResourceRequest} and returns unused {@link Container} allocated to
* <code>ApplicationMaster</code> can also <em>blacklist</em> resources * it via {@link AllocateRequest}. Optionally, the
* which it doesn't want to use.</p> * <code>ApplicationMaster</code> can also <em>blacklist</em> resources which
* it doesn't want to use.
* </p>
* *
* <p>This also doubles up as a <em>heartbeat</em> to let the * <p>
* This also doubles up as a <em>heartbeat</em> to let the
* <code>ResourceManager</code> know that the <code>ApplicationMaster</code> * <code>ResourceManager</code> know that the <code>ApplicationMaster</code>
* is alive. Thus, applications should periodically make this call to be kept * is alive. Thus, applications should periodically make this call to be kept
* alive. The frequency depends on * alive. The frequency depends on
* {@link YarnConfiguration#RM_AM_EXPIRY_INTERVAL_MS} which defaults to * {@link YarnConfiguration#RM_AM_EXPIRY_INTERVAL_MS} which defaults to
* {@link YarnConfiguration#DEFAULT_RM_AM_EXPIRY_INTERVAL_MS}.</p> * {@link YarnConfiguration#DEFAULT_RM_AM_EXPIRY_INTERVAL_MS}.
* </p>
* *
* <p>The <code>ResourceManager</code> responds with list of allocated * <p>
* {@link Container}, status of completed containers and headroom information * The <code>ResourceManager</code> responds with list of allocated
* for the application.</p> * {@link Container}, status of completed containers and headroom information
* for the application.
* </p>
* *
* <p>The <code>ApplicationMaster</code> can use the available headroom * <p>
* (resources) to decide how to utilized allocated resources and make * The <code>ApplicationMaster</code> can use the available headroom
* informed decisions about future resource requests.</p> * (resources) to decide how to utilized allocated resources and make informed
* decisions about future resource requests.
* </p>
* *
* @param request allocation request * @param request
* allocation request
* @return allocation response * @return allocation response
* @throws YarnException * @throws YarnException
* @throws IOException * @throws IOException
* @throws InvalidApplicationMasterRequestException
* This exception is thrown when an ApplicationMaster calls allocate
* without registering first.
* @throws InvalidResourceBlacklistRequestException
* This exception is thrown when an application provides an invalid
* specification for blacklist of resources.
* @throws InvalidResourceRequestException
* This exception is thrown when a {@link ResourceRequest} is out of
* the range of the configured lower and upper limits on the
* resources.
* @see AllocateRequest * @see AllocateRequest
* @see AllocateResponse * @see AllocateResponse
*/ */

View File

@ -32,6 +32,8 @@ import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.exceptions.InvalidContainerException;
import org.apache.hadoop.yarn.exceptions.NMNotYetReadyException;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
/** /**
@ -49,28 +51,40 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
@Stable @Stable
public interface ContainerManagementProtocol { public interface ContainerManagementProtocol {
/** /**
* <p>The <code>ApplicationMaster</code> requests a <code>NodeManager</code> * <p>
* to <em>start</em> a {@link Container} allocated to it using this interface. * The <code>ApplicationMaster</code> requests a <code>NodeManager</code> to
* <em>start</em> a {@link Container} allocated to it using this interface.
* </p> * </p>
* *
* <p>The <code>ApplicationMaster</code> has to provide details such as * <p>
* allocated resource capability, security tokens (if enabled), command * The <code>ApplicationMaster</code> has to provide details such as allocated
* to be executed to start the container, environment for the process, * resource capability, security tokens (if enabled), command to be executed
* necessary binaries/jar/shared-objects etc. via the * to start the container, environment for the process, necessary
* {@link ContainerLaunchContext} in the {@link StartContainerRequest}.</p> * binaries/jar/shared-objects etc. via the {@link ContainerLaunchContext} in
* the {@link StartContainerRequest}.
* </p>
* *
* <p>Currently the <code>NodeManager</code> sends an immediate, empty * <p>
* response via {@link StartContainerResponse} to signify acceptance of the * Currently the <code>NodeManager</code> sends an immediate, empty response
* request and throws an exception in case of errors. The * via {@link StartContainerResponse} to signify acceptance of the request and
* <code>ApplicationMaster</code> can use * throws an exception in case of errors. The <code>ApplicationMaster</code>
* {@link #getContainerStatus(GetContainerStatusRequest)} to get updated * can use {@link #getContainerStatus(GetContainerStatusRequest)} to get
* status of the to-be-launched or launched container.</p> * updated status of the to-be-launched or launched container.
* </p>
* *
* @param request request to start a container * @param request
* @return empty response to indicate acceptance of the request * request to start a container
* or an exception * @return empty response to indicate acceptance of the request or an
* exception
* @throws YarnException * @throws YarnException
* @throws IOException * @throws IOException
* @throws NMNotYetReadyException
* This exception is thrown when NM starts from scratch but has not
* yet connected with RM.
* @throws InvalidContainerException
* This exception is thrown when NM is rejecting start-container
* requests for containers allocated by a previous instance of the
* RM
*/ */
@Public @Public
@Stable @Stable

View File

@ -16,13 +16,18 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.yarn.server.resourcemanager; package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
/** /**
* The exception is thrown when an application Master call allocate without * This exception is thrown when an ApplicationMaster asks for resources by
* calling RegisterApplicationMaster or try to register more then once. * calling {@link ApplicationMasterProtocol#allocate(AllocateRequest)} API
* without first registering by calling
* {@link ApplicationMasterProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)}
* or if it tries to register more then once.
*/ */
public class InvalidApplicationMasterRequestException extends YarnException { public class InvalidApplicationMasterRequestException extends YarnException {

View File

@ -16,12 +16,16 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.yarn.server.nodemanager.containermanager; package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
/** /**
* This Exception happens when NM is rejecting container requests from RM * This exception is thrown by a NodeManager that is rejecting start-container
* requests via
* {@link ContainerManagementProtocol#startContainer(StartContainerRequest)}
* for containers allocated by a previous instance of the RM.
*/ */
public class InvalidContainerException extends YarnException { public class InvalidContainerException extends YarnException {

View File

@ -16,17 +16,20 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.yarn.server.resourcemanager.scheduler; package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.exceptions.YarnException;
/** /**
* The exception is thrown when an application provides an invalid * This exception is thrown when an application provides an invalid
* specification for the blacklist. * {@link ResourceBlacklistRequest} specification for blacklisting of resources
* in {@link ApplicationMasterProtocol#allocate(AllocateRequest)} API.
* *
* As an e.g., currently this exceptions is thrown when an application * Currently this exceptions is thrown when an application tries to
* tries to blacklist {@link ResourceRequest#ANY}. * blacklist {@link ResourceRequest#ANY}.
*/ */
public class InvalidResourceBlacklistRequestException extends YarnException { public class InvalidResourceBlacklistRequestException extends YarnException {

View File

@ -16,15 +16,18 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.yarn.server.resourcemanager.scheduler; package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.exceptions.YarnException;
/** /**
* The exception is thrown when a {@link ResourceRequest} is out of the range * This exception is thrown when a resource requested via
* of the configured lower and upper resource boundaries. * {@link ResourceRequest} in the
* * {@link ApplicationMasterProtocol#allocate(AllocateRequest)} API is out of the
* range of the configured lower and upper limits on resources.
*
*/ */
public class InvalidResourceRequestException extends YarnException { public class InvalidResourceRequestException extends YarnException {

View File

@ -16,13 +16,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.yarn.server.nodemanager.containermanager; package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
/** /**
* This exception happens when NM starts from scratch but has not yet connected * This exception is thrown on
* with RM. * {@link ContainerManagementProtocol#startContainer(StartContainerRequest)} API
* when an NM starts from scratch but has not yet connected with RM.
*/ */
public class NMNotYetReadyException extends YarnException { public class NMNotYetReadyException extends YarnException {

View File

@ -64,6 +64,8 @@ import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.AsyncDispatcher; import org.apache.hadoop.yarn.event.AsyncDispatcher;
import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.InvalidContainerException;
import org.apache.hadoop.yarn.exceptions.NMNotYetReadyException;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;

View File

@ -35,11 +35,11 @@ import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher; import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.exceptions.NMNotYetReadyException;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl; import org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.NMNotYetReadyException;
import org.apache.hadoop.yarn.server.nodemanager.metrics.NodeManagerMetrics; import org.apache.hadoop.yarn.server.nodemanager.metrics.NodeManagerMetrics;
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager; import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
import org.junit.After; import org.junit.After;

View File

@ -53,6 +53,7 @@ import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.Token; import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.api.records.URL; import org.apache.hadoop.yarn.api.records.URL;
import org.apache.hadoop.yarn.exceptions.InvalidContainerException;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier; import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
import org.apache.hadoop.yarn.security.NMTokenIdentifier; import org.apache.hadoop.yarn.security.NMTokenIdentifier;

View File

@ -58,6 +58,9 @@ import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.api.records.StrictPreemptionContract; import org.apache.hadoop.yarn.api.records.StrictPreemptionContract;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -72,8 +75,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAt
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptUnregistrationEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptUnregistrationEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.InvalidResourceBlacklistRequestException;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.InvalidResourceRequestException;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;

View File

@ -34,6 +34,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.ipc.RPCUtil; import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger.AuditConstants; import org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger.AuditConstants;
@ -48,7 +49,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.InvalidResourceRequestException;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager; import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;

View File

@ -28,6 +28,8 @@ import org.apache.hadoop.yarn.api.records.ContainerState;
import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.util.resource.ResourceCalculator; import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
@ -155,6 +157,9 @@ public class SchedulerUtils {
/** /**
* Utility method to validate a resource request, by insuring that the * Utility method to validate a resource request, by insuring that the
* requested memory/vcore is non-negative and not greater than max * requested memory/vcore is non-negative and not greater than max
*
* @throws <code>InvalidResourceRequestException</code> when there is invalid
* request
*/ */
public static void validateResourceRequest(ResourceRequest resReq, public static void validateResourceRequest(ResourceRequest resReq,
Resource maximumResource) throws InvalidResourceRequestException { Resource maximumResource) throws InvalidResourceRequestException {
@ -189,6 +194,10 @@ public class SchedulerUtils {
} }
} }
/*
* @throw <code>InvalidResourceBlacklistRequestException </code> if the
* resource is not able to be added to the blacklist.
*/
public static void validateBlacklistRequest(ResourceBlacklistRequest blacklistRequest) public static void validateBlacklistRequest(ResourceBlacklistRequest blacklistRequest)
throws InvalidResourceBlacklistRequestException { throws InvalidResourceBlacklistRequestException {
if (blacklistRequest != null) { if (blacklistRequest != null) {

View File

@ -42,6 +42,8 @@ import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourceRequestPBImpl; import org.apache.hadoop.yarn.api.records.impl.pb.ResourceRequestPBImpl;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
import org.apache.hadoop.yarn.ipc.YarnRPC; import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.server.resourcemanager.MockNM; import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
import org.apache.hadoop.yarn.server.resourcemanager.MockRM; import org.apache.hadoop.yarn.server.resourcemanager.MockRM;