Class FederationInterceptorREST
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebServiceProtocol,RESTRequestInterceptor
AbstractRESTRequestInterceptor class and provides an
implementation for federation of YARN RM and scaling an application across
multiple YARN SubClusters. All the federation specific implementation is
encapsulated in this class. This is always the last interceptor in the chain.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.ResponseaddToClusterNodeLabels(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo newNodeLabels, javax.servlet.http.HttpServletRequest hsr) This method adds specific node labels for specific nodes, and it is reachable by usingRMWSConsts.ADD_NODE_LABELS.javax.ws.rs.core.ResponsecancelDelegationToken(javax.servlet.http.HttpServletRequest hsr) Cancel DelegationToken.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.RMQueueAclInfocheckUserAccessToQueue(String queue, String username, String queueAclType, javax.servlet.http.HttpServletRequest hsr) javax.ws.rs.core.ResponsecreateNewApplication(javax.servlet.http.HttpServletRequest hsr) YARN Router forwards every getNewApplication requests to any RM.javax.ws.rs.core.ResponsecreateNewReservation(javax.servlet.http.HttpServletRequest hsr) javax.ws.rs.core.ResponsedeleteReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationDeleteRequestInfo resContext, javax.servlet.http.HttpServletRequest hsr) dumpSchedulerLogs(String time, javax.servlet.http.HttpServletRequest hsr) This method dumps the scheduler logs for the time got in input, and it is reachable by usingRMWSConsts.SCHEDULER_LOGS.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfoget()org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ActivitiesInfogetActivities(javax.servlet.http.HttpServletRequest hsr, String nodeId, String groupBy) This method retrieve all the activities in a specific node, and it is reachable by usingRMWSConsts.SCHEDULER_ACTIVITIES.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfoThe YARN Router will forward to the respective YARN RM in which the AM is running.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppActivitiesInfogetAppActivities(javax.servlet.http.HttpServletRequest hsr, String appId, String time, Set<String> requestPriorities, Set<String> allocationRequestIds, String groupBy, String limit, Set<String> actions, boolean summarize) org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfogetAppAttempt(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String appId, String appAttemptId) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptsInfogetAppAttempts(javax.servlet.http.HttpServletRequest hsr, String appId) org.apache.hadoop.yarn.util.LRUCacheHashMap<RouterAppInfoCacheKey,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo> org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPrioritygetAppPriority(javax.servlet.http.HttpServletRequest hsr, String appId) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueuegetAppQueue(javax.servlet.http.HttpServletRequest hsr, String appId) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfogetApps(javax.servlet.http.HttpServletRequest hsr, String stateQuery, Set<String> statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set<String> applicationTypes, Set<String> applicationTags, String name, Set<String> unselectedFields) The YARN Router will forward the request to all the YARN RMs in parallel, after that it will group all the ApplicationReports by the ApplicationId.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppStategetAppState(javax.servlet.http.HttpServletRequest hsr, String appId) The YARN Router will forward to the respective YARN RM in which the AM is running.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfogetAppStatistics(javax.servlet.http.HttpServletRequest hsr, Set<String> stateQueries, Set<String> typeQueries) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfogetAppTimeout(javax.servlet.http.HttpServletRequest hsr, String appId, String type) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutsInfogetAppTimeouts(javax.servlet.http.HttpServletRequest hsr, String appId) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.BulkActivitiesInfogetBulkActivities(javax.servlet.http.HttpServletRequest hsr, String groupBy, int activitiesCount) This method retrieve the last n activities inside scheduler, and it is reachable by usingRMWSConsts.SCHEDULER_BULK_ACTIVITIES.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfoThis method retrieves the cluster information, and it is reachable by usingRMWSConsts.INFO.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfoorg.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfogetClusterNodeLabels(javax.servlet.http.HttpServletRequest hsr) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterUserInfogetClusterUserInfo(javax.servlet.http.HttpServletRequest hsr) This method retrieves the cluster user information, and it is reachable by usingRMWSConsts.CLUSTER_USER_INFO.org.apache.hadoop.yarn.server.webapp.dao.ContainerInfogetContainer(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String appId, String appAttemptId, String containerId) org.apache.hadoop.yarn.server.webapp.dao.ContainersInfogetContainers(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String appId, String appAttemptId) protected DefaultRequestInterceptorRESTgetInterceptorForSubCluster(org.apache.hadoop.yarn.server.federation.store.records.SubClusterId subClusterId) Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId,DefaultRequestInterceptorREST> org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfogetLabelsOnNode(javax.servlet.http.HttpServletRequest hsr, String nodeId) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfogetLabelsToNodes(Set<String> labels) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfoThe YARN Router will forward to the request to all the SubClusters to find where the node is running.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfoThe YARN Router will forward the request to all the YARN RMs in parallel, after that it will remove all the duplicated NodeInfo by using the NodeId.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfogetNodeToLabels(javax.servlet.http.HttpServletRequest hsr) protected DefaultRequestInterceptorRESTprotected DefaultRequestInterceptorRESTgetOrCreateInterceptorByNodeId(String nodeId) protected DefaultRequestInterceptorRESTgetOrCreateInterceptorForSubCluster(org.apache.hadoop.yarn.server.federation.store.records.SubClusterId subClusterId, String webAppAddress) protected DefaultRequestInterceptorRESTgetOrCreateInterceptorForSubCluster(org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo subClusterInfo) org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfogetRMNodeLabels(javax.servlet.http.HttpServletRequest hsr) javax.ws.rs.core.ResponsegetSchedulerConfiguration(javax.servlet.http.HttpServletRequest hsr) This method retrieves all the Scheduler configuration, and it is reachable by usingRMWSConsts.SCHEDULER_CONF.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfoThis method retrieves the current scheduler status, and it is reachable by usingRMWSConsts.SCHEDULER.voidInitializes theRESTRequestInterceptor.Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo> javax.ws.rs.core.ResponselistReservation(String queue, String reservationId, long startTime, long endTime, boolean includeResourceAllocations, javax.servlet.http.HttpServletRequest hsr) javax.ws.rs.core.ResponsepostDelegationToken(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.DelegationToken tokenData, javax.servlet.http.HttpServletRequest hsr) This method posts a delegation token from the client.javax.ws.rs.core.ResponsepostDelegationTokenExpiration(javax.servlet.http.HttpServletRequest hsr) This method updates the expiration for a delegation token from the client.javax.ws.rs.core.ResponseremoveFromClusterNodeLabels(Set<String> oldNodeLabels, javax.servlet.http.HttpServletRequest hsr) This method removes all the node labels for specific nodes, and it is reachable by usingRMWSConsts.REMOVE_NODE_LABELS.javax.ws.rs.core.ResponsereplaceLabelsOnNode(Set<String> newNodeLabelsName, javax.servlet.http.HttpServletRequest hsr, String nodeId) This method replaces all the node labels for specific node, and it is reachable by usingRMWSConsts.NODES_NODEID_REPLACE_LABELS.javax.ws.rs.core.ResponsereplaceLabelsOnNodes(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsEntryList newNodeToLabels, javax.servlet.http.HttpServletRequest hsr) This method replaces all the node labels for specific nodes, and it is reachable by usingRMWSConsts.REPLACE_NODE_TO_LABELS.voidsetAllowPartialResult(boolean allowPartialResult) voidSets theRESTRequestInterceptorin the chain.voidshutdown()Disposes theRESTRequestInterceptor.javax.ws.rs.core.ResponsesignalToContainer(String containerId, String command, javax.servlet.http.HttpServletRequest req) javax.ws.rs.core.ResponsesubmitApplication(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo newApp, javax.servlet.http.HttpServletRequest hsr) Today, in YARN there are no checks of any applicationId submitted.javax.ws.rs.core.ResponsesubmitReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo resContext, javax.servlet.http.HttpServletRequest hsr) javax.ws.rs.core.ResponseupdateApplicationPriority(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPriority targetPriority, javax.servlet.http.HttpServletRequest hsr, String appId) javax.ws.rs.core.ResponseupdateApplicationTimeout(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfo appTimeout, javax.servlet.http.HttpServletRequest hsr, String appId) javax.ws.rs.core.ResponseupdateAppQueue(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueue targetQueue, javax.servlet.http.HttpServletRequest hsr, String appId) javax.ws.rs.core.ResponseupdateAppState(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState targetState, javax.servlet.http.HttpServletRequest hsr, String appId) The YARN Router will forward to the respective YARN RM in which the AM is running.org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfoupdateNodeResource(javax.servlet.http.HttpServletRequest hsr, String nodeId, org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceOptionInfo resourceOption) This method changes the resources of a specific node, and it is reachable by usingRMWSConsts.NODE_RESOURCE.javax.ws.rs.core.ResponseupdateReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationUpdateRequestInfo resContext, javax.servlet.http.HttpServletRequest hsr) javax.ws.rs.core.ResponseupdateSchedulerConfiguration(org.apache.hadoop.yarn.webapp.dao.SchedConfUpdateInfo mutationInfo, javax.servlet.http.HttpServletRequest hsr) This method updates the Scheduler configuration, and it is reachable by usingRMWSConsts.SCHEDULER_CONF.Methods inherited from class org.apache.hadoop.yarn.server.router.webapp.AbstractRESTRequestInterceptor
getConf, getNextInterceptor, getRouterClientRMService, getUser, setConf, setRouterClientRMService
-
Constructor Details
-
FederationInterceptorREST
public FederationInterceptorREST()
-
-
Method Details
-
init
Description copied from class:AbstractRESTRequestInterceptorInitializes theRESTRequestInterceptor.- Specified by:
initin interfaceRESTRequestInterceptor- Overrides:
initin classAbstractRESTRequestInterceptor- Parameters:
user- the name of the client
-
getInterceptorForSubCluster
@VisibleForTesting protected DefaultRequestInterceptorREST getInterceptorForSubCluster(org.apache.hadoop.yarn.server.federation.store.records.SubClusterId subClusterId) -
getOrCreateInterceptorForSubCluster
protected DefaultRequestInterceptorREST getOrCreateInterceptorForSubCluster(org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo subClusterInfo) -
getOrCreateInterceptorByAppId
protected DefaultRequestInterceptorREST getOrCreateInterceptorByAppId(String appId) throws org.apache.hadoop.yarn.exceptions.YarnException - Throws:
org.apache.hadoop.yarn.exceptions.YarnException
-
getOrCreateInterceptorByNodeId
-
getOrCreateInterceptorForSubCluster
@VisibleForTesting protected DefaultRequestInterceptorREST getOrCreateInterceptorForSubCluster(org.apache.hadoop.yarn.server.federation.store.records.SubClusterId subClusterId, String webAppAddress) -
createNewApplication
public javax.ws.rs.core.Response createNewApplication(javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException YARN Router forwards every getNewApplication requests to any RM. During this operation there will be no communication with the State Store. The Router will forward the requests to any SubCluster. The Router will retry to submit the request on #numSubmitRetries different SubClusters. The SubClusters are randomly chosen from the active ones.Possible failures and behaviors:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit.
ResourceManager: the Router will timeout and contacts another RM.
StateStore: not in the execution.
- Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionIOExceptionInterruptedException
-
submitApplication
public javax.ws.rs.core.Response submitApplication(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo newApp, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException Today, in YARN there are no checks of any applicationId submitted.Base scenarios:
The Client submits an application to the Router. The Router selects one SubCluster to forward the request. The Router inserts a tuple into StateStore with the selected SubCluster (e.g. SC1) and the appId. The State Store replies with the selected SubCluster (e.g. SC1). The Router submits the request to the selected SubCluster.
In case of State Store failure:
The client submits an application to the Router. The Router selects one SubCluster to forward the request. The Router inserts a tuple into State Store with the selected SubCluster (e.g. SC1) and the appId. Due to the State Store down the Router times out and it will retry depending on the FederationFacade settings. The Router replies to the client with an error message.
If State Store fails after inserting the tuple: identical behavior as
RMWebServices.In case of Router failure:
Scenario 1 – Crash before submission to the ResourceManager
The Client submits an application to the Router. The Router selects one SubCluster to forward the request. The Router inserts a tuple into State Store with the selected SubCluster (e.g. SC1) and the appId. The Router crashes. The Client timeouts and resubmits the application. The Router selects one SubCluster to forward the request. The Router inserts a tuple into State Store with the selected SubCluster (e.g. SC2) and the appId. Because the tuple is already inserted in the State Store, it returns the previous selected SubCluster (e.g. SC1). The Router submits the request to the selected SubCluster (e.g. SC1).
Scenario 2 – Crash after submission to the ResourceManager
The Client submits an application to the Router. The Router selects one SubCluster to forward the request. The Router inserts a tuple into State Store with the selected SubCluster (e.g. SC1) and the appId. The Router submits the request to the selected SubCluster. The Router crashes. The Client timeouts and resubmit the application. The Router selects one SubCluster to forward the request. The Router inserts a tuple into State Store with the selected SubCluster (e.g. SC2) and the appId. The State Store replies with the selected SubCluster (e.g. SC1). The Router submits the request to the selected SubCluster (e.g. SC1). When a client re-submits the same application to the same RM, it does not raise an exception and replies with operation successful message.
In case of Client failure: identical behavior as
RMWebServices.In case of ResourceManager failure:
The Client submits an application to the Router. The Router selects one SubCluster to forward the request. The Router inserts a tuple into State Store with the selected SubCluster (e.g. SC1) and the appId. The Router submits the request to the selected SubCluster. The entire SubCluster is down – all the RMs in HA or the master RM is not reachable. The Router times out. The Router selects a new SubCluster to forward the request. The Router update a tuple into State Store with the selected SubCluster (e.g. SC2) and the appId. The State Store replies with OK answer. The Router submits the request to the selected SubCluster (e.g. SC2).
- Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionIOExceptionInterruptedException
-
getApp
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo getApp(javax.servlet.http.HttpServletRequest hsr, String appId, Set<String> unselectedFields) The YARN Router will forward to the respective YARN RM in which the AM is running.Possible failure:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit the request.
ResourceManager: the Router will timeout and the call will fail.
State Store: the Router will timeout and it will retry depending on the FederationFacade settings - if the failure happened before the select operation.
-
updateAppState
public javax.ws.rs.core.Response updateAppState(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState targetState, javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException, org.apache.hadoop.yarn.exceptions.YarnException, InterruptedException, IOException The YARN Router will forward to the respective YARN RM in which the AM is running.Possible failures and behaviors:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit the request.
ResourceManager: the Router will timeout and the call will fail.
State Store: the Router will timeout and it will retry depending on the FederationFacade settings - if the failure happened before the select operation.
- Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionorg.apache.hadoop.yarn.exceptions.YarnExceptionInterruptedExceptionIOException
-
getApps
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo getApps(javax.servlet.http.HttpServletRequest hsr, String stateQuery, Set<String> statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set<String> applicationTypes, Set<String> applicationTags, String name, Set<String> unselectedFields) The YARN Router will forward the request to all the YARN RMs in parallel, after that it will group all the ApplicationReports by the ApplicationId.Possible failure:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit the request.
ResourceManager: the Router calls each YARN RM in parallel by using one thread for each YARN RM. In case a YARN RM fails, a single call will timeout. However, the Router will merge the ApplicationReports it got, and provides a partial list to the client.
State Store: the Router will timeout and it will retry depending on the FederationFacade settings - if the failure happened before the select operation.
-
getNode
The YARN Router will forward to the request to all the SubClusters to find where the node is running.Possible failure:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit the request.
ResourceManager: the Router will timeout and the call will fail.
State Store: the Router will timeout and it will retry depending on the FederationFacade settings - if the failure happened before the select operation.
-
getNodes
The YARN Router will forward the request to all the YARN RMs in parallel, after that it will remove all the duplicated NodeInfo by using the NodeId.Possible failure:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit the request.
ResourceManager: the Router calls each YARN RM in parallel by using one thread for each YARN RM. In case a YARN RM fails, a single call will timeout. However, the Router will use the NodesInfo it got, and provides a partial list to the client.
State Store: the Router will timeout and it will retry depending on the FederationFacade settings - if the failure happened before the select operation.
-
updateNodeResource
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceInfo updateNodeResource(javax.servlet.http.HttpServletRequest hsr, String nodeId, org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ResourceOptionInfo resourceOption) This method changes the resources of a specific node, and it is reachable by usingRMWSConsts.NODE_RESOURCE.- Parameters:
hsr- The servlet request.nodeId- The node we want to retrieve the information for. It is a PathParam.resourceOption- The resource change.- Returns:
- the resources of a specific node.
-
getClusterMetricsInfo
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo getClusterMetricsInfo() -
getAppState
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState getAppState(javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException The YARN Router will forward to the respective YARN RM in which the AM is running.Possible failure:
Client: identical behavior as
RMWebServices.Router: the Client will timeout and resubmit the request.
ResourceManager: the Router will timeout and the call will fail.
State Store: the Router will timeout and it will retry depending on the FederationFacade settings - if the failure happened before the select operation.
- Throws:
org.apache.hadoop.security.authorize.AuthorizationException
-
get
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfo get() -
getClusterInfo
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfo getClusterInfo()This method retrieves the cluster information, and it is reachable by usingRMWSConsts.INFO. In Federation mode, we will return a FederationClusterInfo object, which contains a set of ClusterInfo.- Returns:
- the cluster information.
-
getClusterUserInfo
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterUserInfo getClusterUserInfo(javax.servlet.http.HttpServletRequest hsr) This method retrieves the cluster user information, and it is reachable by usingRMWSConsts.CLUSTER_USER_INFO. In Federation mode, we will return a ClusterUserInfo object, which contains a set of ClusterUserInfo.- Parameters:
hsr- the servlet request- Returns:
- the cluster user information
-
getSchedulerInfo
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo getSchedulerInfo()This method retrieves the current scheduler status, and it is reachable by usingRMWSConsts.SCHEDULER. For the federation mode, the SchedulerType information of the cluster cannot be integrated and displayed, and the specific cluster information needs to be marked.- Returns:
- the current scheduler status
-
dumpSchedulerLogs
public String dumpSchedulerLogs(String time, javax.servlet.http.HttpServletRequest hsr) throws IOException This method dumps the scheduler logs for the time got in input, and it is reachable by usingRMWSConsts.SCHEDULER_LOGS.- Parameters:
time- the period of time. It is a FormParam.hsr- the servlet request- Returns:
- the result of the operation
- Throws:
IOException- when it cannot create dump log file
-
getActivities
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ActivitiesInfo getActivities(javax.servlet.http.HttpServletRequest hsr, String nodeId, String groupBy) This method retrieve all the activities in a specific node, and it is reachable by usingRMWSConsts.SCHEDULER_ACTIVITIES.- Parameters:
hsr- the servlet requestnodeId- the node we want to retrieve the activities. It is a QueryParam.groupBy- the groupBy type by which the activities should be aggregated. It is a QueryParam.- Returns:
- all the activities in the specific node
-
getBulkActivities
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.BulkActivitiesInfo getBulkActivities(javax.servlet.http.HttpServletRequest hsr, String groupBy, int activitiesCount) throws InterruptedException This method retrieve the last n activities inside scheduler, and it is reachable by usingRMWSConsts.SCHEDULER_BULK_ACTIVITIES.- Parameters:
hsr- the servlet requestgroupBy- the groupBy type by which the activities should be aggregated. It is a QueryParam.activitiesCount- number of activities- Returns:
- last n activities
- Throws:
InterruptedException
-
getAppActivities
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppActivitiesInfo getAppActivities(javax.servlet.http.HttpServletRequest hsr, String appId, String time, Set<String> requestPriorities, Set<String> allocationRequestIds, String groupBy, String limit, Set<String> actions, boolean summarize) -
getAppStatistics
-
getNodeToLabels
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo getNodeToLabels(javax.servlet.http.HttpServletRequest hsr) throws IOException - Throws:
IOException
-
getRMNodeLabels
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo getRMNodeLabels(javax.servlet.http.HttpServletRequest hsr) throws IOException - Throws:
IOException
-
getLabelsToNodes
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfo getLabelsToNodes(Set<String> labels) throws IOException - Throws:
IOException
-
replaceLabelsOnNodes
public javax.ws.rs.core.Response replaceLabelsOnNodes(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsEntryList newNodeToLabels, javax.servlet.http.HttpServletRequest hsr) throws IOException This method replaces all the node labels for specific nodes, and it is reachable by usingRMWSConsts.REPLACE_NODE_TO_LABELS.- Parameters:
newNodeToLabels- the list of new labels. It is a content param.hsr- the servlet request- Returns:
- Response containing the status code
- Throws:
IOException- if an exception happened- See Also:
-
ResourceManagerAdministrationProtocol.replaceLabelsOnNode(org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest)
-
replaceLabelsOnNode
public javax.ws.rs.core.Response replaceLabelsOnNode(Set<String> newNodeLabelsName, javax.servlet.http.HttpServletRequest hsr, String nodeId) throws Exception This method replaces all the node labels for specific node, and it is reachable by usingRMWSConsts.NODES_NODEID_REPLACE_LABELS.- Parameters:
newNodeLabelsName- the list of new labels. It is a QueryParam.hsr- the servlet requestnodeId- the node we want to replace the node labels. It is a PathParam.- Returns:
- Response containing the status code
- Throws:
Exception- if an exception happened- See Also:
-
ResourceManagerAdministrationProtocol.replaceLabelsOnNode(org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceLabelsOnNodeRequest)
-
getClusterNodeLabels
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo getClusterNodeLabels(javax.servlet.http.HttpServletRequest hsr) throws IOException - Throws:
IOException
-
addToClusterNodeLabels
public javax.ws.rs.core.Response addToClusterNodeLabels(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo newNodeLabels, javax.servlet.http.HttpServletRequest hsr) throws Exception This method adds specific node labels for specific nodes, and it is reachable by usingRMWSConsts.ADD_NODE_LABELS.- Parameters:
newNodeLabels- the node labels to add. It is a content param.hsr- the servlet request- Returns:
- Response containing the status code
- Throws:
Exception- in case of bad request- See Also:
-
ResourceManagerAdministrationProtocol.addToClusterNodeLabels(org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterNodeLabelsRequest)
-
removeFromClusterNodeLabels
public javax.ws.rs.core.Response removeFromClusterNodeLabels(Set<String> oldNodeLabels, javax.servlet.http.HttpServletRequest hsr) throws Exception This method removes all the node labels for specific nodes, and it is reachable by usingRMWSConsts.REMOVE_NODE_LABELS.- Parameters:
oldNodeLabels- the node labels to remove. It is a QueryParam.hsr- the servlet request- Returns:
- Response containing the status code
- Throws:
Exception- in case of bad request- See Also:
-
ResourceManagerAdministrationProtocol.removeFromClusterNodeLabels(org.apache.hadoop.yarn.server.api.protocolrecords.RemoveFromClusterNodeLabelsRequest)
-
getLabelsOnNode
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo getLabelsOnNode(javax.servlet.http.HttpServletRequest hsr, String nodeId) throws IOException - Throws:
IOException
-
getAppPriority
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPriority getAppPriority(javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException - Throws:
org.apache.hadoop.security.authorize.AuthorizationException
-
updateApplicationPriority
public javax.ws.rs.core.Response updateApplicationPriority(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPriority targetPriority, javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException, org.apache.hadoop.yarn.exceptions.YarnException, InterruptedException, IOException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionorg.apache.hadoop.yarn.exceptions.YarnExceptionInterruptedExceptionIOException
-
getAppQueue
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueue getAppQueue(javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException - Throws:
org.apache.hadoop.security.authorize.AuthorizationException
-
updateAppQueue
public javax.ws.rs.core.Response updateAppQueue(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueue targetQueue, javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException, org.apache.hadoop.yarn.exceptions.YarnException, InterruptedException, IOException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionorg.apache.hadoop.yarn.exceptions.YarnExceptionInterruptedExceptionIOException
-
postDelegationToken
public javax.ws.rs.core.Response postDelegationToken(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.DelegationToken tokenData, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException, Exception This method posts a delegation token from the client.- Parameters:
tokenData- the token to delegate. It is a content param.hsr- the servlet request.- Returns:
- Response containing the status code.
- Throws:
org.apache.hadoop.security.authorize.AuthorizationException- if Kerberos auth failed.IOException- if the delegation failed.InterruptedException- if interrupted.Exception- in case of bad request.
-
postDelegationTokenExpiration
public javax.ws.rs.core.Response postDelegationTokenExpiration(javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException, Exception This method updates the expiration for a delegation token from the client.- Parameters:
hsr- the servlet request- Returns:
- Response containing the status code.
- Throws:
org.apache.hadoop.security.authorize.AuthorizationException- if Kerberos auth failed.IOException- if the delegation failed.InterruptedException- if interrupted.Exception- in case of bad request.
-
cancelDelegationToken
public javax.ws.rs.core.Response cancelDelegationToken(javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException, Exception Cancel DelegationToken.- Parameters:
hsr- the servlet request- Returns:
- Response containing the status code.
- Throws:
org.apache.hadoop.security.authorize.AuthorizationException- if Kerberos auth failed.IOException- if the delegation failed.InterruptedException- if interrupted.Exception- in case of bad request.
-
createNewReservation
public javax.ws.rs.core.Response createNewReservation(javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionIOExceptionInterruptedException
-
submitReservation
public javax.ws.rs.core.Response submitReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo resContext, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionIOExceptionInterruptedException
-
updateReservation
public javax.ws.rs.core.Response updateReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationUpdateRequestInfo resContext, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionIOExceptionInterruptedException
-
deleteReservation
public javax.ws.rs.core.Response deleteReservation(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationDeleteRequestInfo resContext, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, IOException, InterruptedException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionIOExceptionInterruptedException
-
listReservation
public javax.ws.rs.core.Response listReservation(String queue, String reservationId, long startTime, long endTime, boolean includeResourceAllocations, javax.servlet.http.HttpServletRequest hsr) throws Exception - Throws:
Exception
-
getAppTimeout
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfo getAppTimeout(javax.servlet.http.HttpServletRequest hsr, String appId, String type) throws org.apache.hadoop.security.authorize.AuthorizationException - Throws:
org.apache.hadoop.security.authorize.AuthorizationException
-
getAppTimeouts
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutsInfo getAppTimeouts(javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException - Throws:
org.apache.hadoop.security.authorize.AuthorizationException
-
updateApplicationTimeout
public javax.ws.rs.core.Response updateApplicationTimeout(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfo appTimeout, javax.servlet.http.HttpServletRequest hsr, String appId) throws org.apache.hadoop.security.authorize.AuthorizationException, org.apache.hadoop.yarn.exceptions.YarnException, InterruptedException, IOException - Throws:
org.apache.hadoop.security.authorize.AuthorizationExceptionorg.apache.hadoop.yarn.exceptions.YarnExceptionInterruptedExceptionIOException
-
getAppAttempts
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptsInfo getAppAttempts(javax.servlet.http.HttpServletRequest hsr, String appId) -
checkUserAccessToQueue
public org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.RMQueueAclInfo checkUserAccessToQueue(String queue, String username, String queueAclType, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException - Throws:
org.apache.hadoop.security.authorize.AuthorizationException
-
getAppAttempt
public org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo getAppAttempt(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String appId, String appAttemptId) - Parameters:
req- the servlet requestres- the servlet responseappId- the application we want to get the appAttempt. It is a PathParam.appAttemptId- the AppAttempt we want to get the info. It is a PathParam.- Returns:
- AppAttemptInfo of the specific AppAttempt
- See Also:
-
WebServices.getAppAttempt(HttpServletRequest, HttpServletResponse, String, String)
-
getContainers
public org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo getContainers(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String appId, String appAttemptId) - Parameters:
req- the servlet requestres- the servlet responseappId- the application we want to get the containers info. It is a PathParam.appAttemptId- the AppAttempt we want to get the info. It is a PathParam.- Returns:
- ContainersInfo of all the containers that belong to the specific AppAttempt
- See Also:
-
WebServices.getContainers(HttpServletRequest, HttpServletResponse, String, String)
-
getContainer
public org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo getContainer(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String appId, String appAttemptId, String containerId) - Parameters:
req- the servlet requestres- the servlet responseappId- the application we want to get the containers info. It is a PathParam.appAttemptId- the AppAttempt we want to get the info. It is a PathParam.containerId- the container we want to get the info. It is a PathParam.- Returns:
- ContainerInfo of the specific ContainerId
- See Also:
-
WebServices.getContainer(HttpServletRequest, HttpServletResponse, String, String, String)
-
updateSchedulerConfiguration
public javax.ws.rs.core.Response updateSchedulerConfiguration(org.apache.hadoop.yarn.webapp.dao.SchedConfUpdateInfo mutationInfo, javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException, InterruptedException This method updates the Scheduler configuration, and it is reachable by usingRMWSConsts.SCHEDULER_CONF.- Parameters:
mutationInfo- th information for making scheduler configuration changes (supports adding, removing, or updating a queue, as well as global scheduler conf changes)hsr- the servlet request- Returns:
- Response containing the status code
- Throws:
org.apache.hadoop.security.authorize.AuthorizationException- if the user is not authorized to invoke this methodInterruptedException- if interrupted
-
getSchedulerConfiguration
public javax.ws.rs.core.Response getSchedulerConfiguration(javax.servlet.http.HttpServletRequest hsr) throws org.apache.hadoop.security.authorize.AuthorizationException This method retrieves all the Scheduler configuration, and it is reachable by usingRMWSConsts.SCHEDULER_CONF.- Parameters:
hsr- the servlet request- Returns:
- Response containing the status code
- Throws:
org.apache.hadoop.security.authorize.AuthorizationException- if the user is not authorized to invoke this method.
-
setNextInterceptor
Description copied from class:AbstractRESTRequestInterceptorSets theRESTRequestInterceptorin the chain.- Specified by:
setNextInterceptorin interfaceRESTRequestInterceptor- Overrides:
setNextInterceptorin classAbstractRESTRequestInterceptor- Parameters:
next- the RESTRequestInterceptor to set in the pipeline
-
signalToContainer
-
shutdown
public void shutdown()Description copied from class:AbstractRESTRequestInterceptorDisposes theRESTRequestInterceptor.- Specified by:
shutdownin interfaceRESTRequestInterceptor- Overrides:
shutdownin classAbstractRESTRequestInterceptor
-
getAppInfosCaches
@VisibleForTesting public org.apache.hadoop.yarn.util.LRUCacheHashMap<RouterAppInfoCacheKey,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo> getAppInfosCaches() -
getInterceptors
@VisibleForTesting public Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId,DefaultRequestInterceptorREST> getInterceptors() -
setAllowPartialResult
public void setAllowPartialResult(boolean allowPartialResult) -
invokeConcurrentGetNodeLabel
@VisibleForTesting public Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo> invokeConcurrentGetNodeLabel() throws IOException, org.apache.hadoop.yarn.exceptions.YarnException- Throws:
IOExceptionorg.apache.hadoop.yarn.exceptions.YarnException
-