YARN-6634. [API] Refactor ResourceManager WebServices to make API explicit. (Giovanni Matteo Fumarola via curino)
This commit is contained in:
parent
24181f559f
commit
547cb53e8a
@ -0,0 +1,202 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
||||
|
||||
/**
|
||||
* Constants for {@code RMWebServiceProtocol}.
|
||||
*/
|
||||
public final class RMWSConsts {
|
||||
|
||||
public static final String EMPTY = "";
|
||||
public static final String ANY = "*";
|
||||
|
||||
public static final String FORWARDED_FOR = "X-Forwarded-For";
|
||||
|
||||
// ----------------Paths for RMWebServiceProtocol----------------
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol}. */
|
||||
public static final String RM_WEB_SERVICE_PATH = "/ws/v1/cluster";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getClusterInfo}. */
|
||||
public static final String INFO = "/info";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getClusterMetricsInfo}. */
|
||||
public static final String METRICS = "/metrics";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getSchedulerInfo}. */
|
||||
public static final String SCHEDULER = "/scheduler";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#dumpSchedulerLogs}. */
|
||||
public static final String SCHEDULER_LOGS = "/scheduler/logs";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getNodes}. */
|
||||
public static final String NODES = "/nodes";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getNode}. */
|
||||
public static final String NODES_NODEID = "/nodes/{nodeId}";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#getApps} and
|
||||
* {@code RMWebServiceProtocol#getApp}.
|
||||
*/
|
||||
public static final String APPS = "/apps";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getActivities}. */
|
||||
public static final String SCHEDULER_ACTIVITIES = "/scheduler/activities";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getAppActivities}. */
|
||||
public static final String SCHEDULER_APP_ACTIVITIES =
|
||||
"/scheduler/app-activities";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getAppStatistics}. */
|
||||
public static final String APP_STATISTICS = "/appstatistics";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getApp}. */
|
||||
public static final String APPS_APPID = "/apps/{appid}";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getAppAttempts}. */
|
||||
public static final String APPS_APPID_APPATTEMPTS =
|
||||
"/apps/{appid}/appattempts";
|
||||
|
||||
/** Path for {@code WebServices#getAppAttempt}. */
|
||||
public static final String APPS_APPID_APPATTEMPTS_APPATTEMPTID =
|
||||
"/apps/{appid}/appattempts/{appattemptid}";
|
||||
|
||||
/** Path for {@code WebServices#getContainers}. */
|
||||
public static final String APPS_APPID_APPATTEMPTS_APPATTEMPTID_CONTAINERS =
|
||||
"/apps/{appid}/appattempts/{appattemptid}/containers";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getNodeToLabels}. */
|
||||
public static final String GET_NODE_TO_LABELS = "/get-node-to-labels";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getLabelsToNodes}. */
|
||||
public static final String LABEL_MAPPINGS = "/label-mappings";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#replaceLabelsOnNodes}. */
|
||||
public static final String REPLACE_NODE_TO_LABELS = "/replace-node-to-labels";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#replaceLabelsOnNode}. */
|
||||
public static final String NODES_NODEID_REPLACE_LABELS =
|
||||
"/nodes/{nodeId}/replace-labels";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getClusterNodeLabels}. */
|
||||
public static final String GET_NODE_LABELS = "/get-node-labels";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#addToClusterNodeLabels}. */
|
||||
public static final String ADD_NODE_LABELS = "/add-node-labels";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#removeFromCluserNodeLabels}. */
|
||||
public static final String REMOVE_NODE_LABELS = "/remove-node-labels";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getLabelsOnNode}. */
|
||||
public static final String NODES_NODEID_GETLABELS =
|
||||
"/nodes/{nodeId}/get-labels";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#getAppPriority} and
|
||||
* {@code RMWebServiceProtocol#updateApplicationPriority}.
|
||||
*/
|
||||
public static final String APPS_APPID_PRIORITY = "/apps/{appid}/priority";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#getAppQueue} and
|
||||
* {@code RMWebServiceProtocol#updateAppQueue}.
|
||||
*/
|
||||
public static final String APPS_APPID_QUEUE = "/apps/{appid}/queue";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#createNewApplication}. */
|
||||
public static final String APPS_NEW_APPLICATION = "/apps/new-application";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#getAppState} and
|
||||
* {@code RMWebServiceProtocol#updateAppState}.
|
||||
*/
|
||||
public static final String APPS_APPID_STATE = "/apps/{appid}/state";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#postDelegationToken} and
|
||||
* {@code RMWebServiceProtocol#cancelDelegationToken}.
|
||||
*/
|
||||
public static final String DELEGATION_TOKEN = "/delegation-token";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#postDelegationTokenExpiration}. */
|
||||
public static final String DELEGATION_TOKEN_EXPIRATION =
|
||||
"/delegation-token/expiration";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#createNewReservation}. */
|
||||
public static final String RESERVATION_NEW = "/reservation/new-reservation";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#submitReservation}. */
|
||||
public static final String RESERVATION_SUBMIT = "/reservation/submit";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#updateReservation}. */
|
||||
public static final String RESERVATION_UPDATE = "/reservation/update";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#deleteReservation}. */
|
||||
public static final String RESERVATION_DELETE = "/reservation/delete";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#listReservation}. */
|
||||
public static final String RESERVATION_LIST = "/reservation/list";
|
||||
|
||||
/** Path for {@code RMWebServiceProtocol#getAppTimeout}. */
|
||||
public static final String APPS_TIMEOUTS_TYPE =
|
||||
"/apps/{appid}/timeouts/{type}";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#getAppTimeouts}.
|
||||
*/
|
||||
public static final String APPS_TIMEOUTS = "/apps/{appid}/timeouts";
|
||||
|
||||
/**
|
||||
* Path for {@code RMWebServiceProtocol#updateApplicationTimeout}.
|
||||
*/
|
||||
public static final String APPS_TIMEOUT = "/apps/{appid}/timeout";
|
||||
|
||||
// ----------------QueryParams for RMWebServiceProtocol----------------
|
||||
|
||||
public static final String TIME = "time";
|
||||
public static final String STATES = "states";
|
||||
public static final String NODEID = "nodeId";
|
||||
public static final String STATE = "state";
|
||||
public static final String FINAL_STATUS = "finalStatus";
|
||||
public static final String USER = "user";
|
||||
public static final String QUEUE = "queue";
|
||||
public static final String LIMIT = "limit";
|
||||
public static final String STARTED_TIME_BEGIN = "startedTimeBegin";
|
||||
public static final String STARTED_TIME_END = "startedTimeEnd";
|
||||
public static final String FINISHED_TIME_BEGIN = "finishedTimeBegin";
|
||||
public static final String FINISHED_TIME_END = "finishedTimeEnd";
|
||||
public static final String APPLICATION_TYPES = "applicationTypes";
|
||||
public static final String APPLICATION_TAGS = "applicationTags";
|
||||
public static final String APP_ID = "appId";
|
||||
public static final String MAX_TIME = "maxTime";
|
||||
public static final String APPATTEMPTID = "appattemptid";
|
||||
public static final String APPID = "appid";
|
||||
public static final String LABELS = "labels";
|
||||
public static final String RESERVATION_ID = "reservation-id";
|
||||
public static final String START_TIME = "start-time";
|
||||
public static final String END_TIME = "end-time";
|
||||
public static final String INCLUDE_RESOURCE = "include-resource-allocations";
|
||||
public static final String TYPE = "type";
|
||||
|
||||
private RMWSConsts() {
|
||||
// not called
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,635 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||
import org.apache.hadoop.security.authorize.AuthorizationException;
|
||||
import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
|
||||
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ActivitiesInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppActivitiesInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppPriority;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppQueue;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppState;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppTimeoutsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationStatisticsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ApplicationSubmissionContextInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.DelegationToken;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.LabelsToNodesInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeLabelsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsEntryList;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodeToLabelsInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationDeleteRequestInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationUpdateRequestInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedulerTypeInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The protocol between clients and the <code>ResourceManager</code> to
|
||||
* submit/abort jobs and to get information on applications, cluster metrics,
|
||||
* nodes, queues, ACLs and reservations via REST calls.
|
||||
* </p>
|
||||
*
|
||||
* The WebService is reachable by using {@link RMWSConsts#RM_WEB_SERVICE_PATH}
|
||||
*/
|
||||
@Private
|
||||
@Evolving
|
||||
public interface RMWebServiceProtocol {
|
||||
|
||||
/**
|
||||
* This method retrieves the cluster information, and it is reachable by using
|
||||
* {@link RMWSConsts#INFO}.
|
||||
*
|
||||
* @return the cluster information
|
||||
*/
|
||||
ClusterInfo get();
|
||||
|
||||
/**
|
||||
* This method retrieves the cluster information, and it is reachable by using
|
||||
* {@link RMWSConsts#INFO}.
|
||||
*
|
||||
* @return the cluster information
|
||||
*/
|
||||
ClusterInfo getClusterInfo();
|
||||
|
||||
/**
|
||||
* This method retrieves the cluster metrics information, and it is reachable
|
||||
* by using {@link RMWSConsts#METRICS}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getClusterMetrics
|
||||
* @return the cluster metrics information
|
||||
*/
|
||||
ClusterMetricsInfo getClusterMetricsInfo();
|
||||
|
||||
/**
|
||||
* This method retrieves the current scheduler status, and it is reachable by
|
||||
* using {@link RMWSConsts#SCHEDULER}.
|
||||
*
|
||||
* @return the current scheduler status
|
||||
*/
|
||||
SchedulerTypeInfo getSchedulerInfo();
|
||||
|
||||
/**
|
||||
* This method dumps the scheduler logs for the time got in input, and it is
|
||||
* reachable by using {@link RMWSConsts#SCHEDULER_LOGS}.
|
||||
*
|
||||
* @param time the period of time
|
||||
* @param hsr the servlet request
|
||||
* @return the result of the operation
|
||||
* @throws IOException when it cannot create dump log file
|
||||
*/
|
||||
String dumpSchedulerLogs(String time, HttpServletRequest hsr)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* This method retrieves all the nodes information in the cluster, and it is
|
||||
* reachable by using {@link RMWSConsts#NODES}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getClusterNodes
|
||||
* @param states the states we want to filter
|
||||
* @return all nodes in the cluster. If the states param is given, returns all
|
||||
* nodes that are in the comma-separated list of states
|
||||
*/
|
||||
NodesInfo getNodes(String states);
|
||||
|
||||
/**
|
||||
* This method retrieves a specific node information, and it is reachable by
|
||||
* using {@link RMWSConsts#NODES_NODEID}.
|
||||
*
|
||||
* @param nodeId the node we want to retrieve the information
|
||||
* @return the information about the node in input
|
||||
*/
|
||||
NodeInfo getNode(String nodeId);
|
||||
|
||||
/**
|
||||
* This method retrieves all the app reports in the cluster, and it is
|
||||
* reachable by using {@link RMWSConsts#APPS}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getApplications
|
||||
* @param hsr the servlet request
|
||||
* @param stateQuery right now the stateQuery is deprecated
|
||||
* @param statesQuery filter the result by states
|
||||
* @param finalStatusQuery filter the result by final states
|
||||
* @param userQuery filter the result by user
|
||||
* @param queueQuery filter the result by queue
|
||||
* @param count set a limit of the result
|
||||
* @param startedBegin filter the result by started begin time
|
||||
* @param startedEnd filter the result by started end time
|
||||
* @param finishBegin filter the result by finish begin time
|
||||
* @param finishEnd filter the result by finish end time
|
||||
* @param applicationTypes filter the result by types
|
||||
* @param applicationTags filter the result by tags
|
||||
* @return all apps in the cluster
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:parameternumber")
|
||||
AppsInfo getApps(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);
|
||||
|
||||
/**
|
||||
* This method retrieve all the activities in a specific node, and it is
|
||||
* reachable by using {@link RMWSConsts#SCHEDULER_ACTIVITIES}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param nodeId the node we want to retrieve the activities
|
||||
* @return all the activities in the specific node
|
||||
*/
|
||||
ActivitiesInfo getActivities(HttpServletRequest hsr, String nodeId);
|
||||
|
||||
/**
|
||||
* This method retrieves all the activities for a specific app for a specific
|
||||
* period of time, and it is reachable by using
|
||||
* {@link RMWSConsts#SCHEDULER_APP_ACTIVITIES}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param appId the applicationId we want to retrieve the activities
|
||||
* @param time for how long we want to retrieve the activities
|
||||
* @return all the activities about a specific app for a specific time
|
||||
*/
|
||||
AppActivitiesInfo getAppActivities(HttpServletRequest hsr, String appId,
|
||||
String time);
|
||||
|
||||
/**
|
||||
* This method retrieves all the statistics for a specific app, and it is
|
||||
* reachable by using {@link RMWSConsts#APP_STATISTICS}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param stateQueries filter the result by states
|
||||
* @param typeQueries filter the result by type names
|
||||
* @return the application's statistics for specific states and types
|
||||
*/
|
||||
ApplicationStatisticsInfo getAppStatistics(HttpServletRequest hsr,
|
||||
Set<String> stateQueries, Set<String> typeQueries);
|
||||
|
||||
/**
|
||||
* This method retrieves the report for a specific app, and it is reachable by
|
||||
* using {@link RMWSConsts#APPS_APPID}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getApplicationReport
|
||||
* @param hsr the servlet request
|
||||
* @param appId the Id of the application we want the report
|
||||
* @return the app report for a specific application
|
||||
*/
|
||||
AppInfo getApp(HttpServletRequest hsr, String appId);
|
||||
|
||||
/**
|
||||
* This method retrieves the state for a specific app, and it is reachable by
|
||||
* using {@link RMWSConsts#APPS_APPID_STATE}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param appId the Id of the application we want the state
|
||||
* @return the state for a specific application
|
||||
* @throws AuthorizationException if the user is not authorized
|
||||
*/
|
||||
AppState getAppState(HttpServletRequest hsr, String appId)
|
||||
throws AuthorizationException;
|
||||
|
||||
/**
|
||||
* This method updates the state of the app in input, and it is reachable by
|
||||
* using {@link RMWSConsts#APPS_APPID_STATE}.
|
||||
*
|
||||
* @param targetState the target state for the app
|
||||
* @param hsr the servlet request
|
||||
* @param appId the Id of the application we want to update the state
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method
|
||||
* @throws YarnException if app does not exist
|
||||
* @throws InterruptedException if interrupted
|
||||
* @throws IOException if doAs action throws an IOException
|
||||
*/
|
||||
Response updateAppState(AppState targetState, HttpServletRequest hsr,
|
||||
String appId) throws AuthorizationException, YarnException,
|
||||
InterruptedException, IOException;
|
||||
|
||||
/**
|
||||
* This method retrieves all the node labels with the respective nodes in the
|
||||
* cluster, and it is reachable by using
|
||||
* {@link RMWSConsts#GET_NODE_TO_LABELS}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getNodeToLabels
|
||||
* @param hsr the servlet request
|
||||
* @return all the nodes within a node label
|
||||
* @throws IOException if an IOException happened
|
||||
*/
|
||||
NodeToLabelsInfo getNodeToLabels(HttpServletRequest hsr) throws IOException;
|
||||
|
||||
/**
|
||||
* This method retrieves all the node within multiple node labels in the
|
||||
* cluster, and it is reachable by using {@link RMWSConsts#LABEL_MAPPINGS}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getLabelsToNodes
|
||||
* @param labels filter the result by node labels
|
||||
* @return all the nodes within multiple node labels
|
||||
* @throws IOException if an IOException happened
|
||||
*/
|
||||
LabelsToNodesInfo getLabelsToNodes(Set<String> labels) throws IOException;
|
||||
|
||||
/**
|
||||
* This method replaces all the node labels for specific nodes, and it is
|
||||
* reachable by using {@link RMWSConsts#REPLACE_NODE_TO_LABELS}.
|
||||
*
|
||||
* @see ResourceManagerAdministrationProtocol#replaceLabelsOnNode
|
||||
* @param newNodeToLabels the list of new labels
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws Exception if an exception happened
|
||||
*/
|
||||
Response replaceLabelsOnNodes(NodeToLabelsEntryList newNodeToLabels,
|
||||
HttpServletRequest hsr) throws Exception;
|
||||
|
||||
/**
|
||||
* This method replaces all the node labels for specific node, and it is
|
||||
* reachable by using {@link RMWSConsts#NODES_NODEID_REPLACE_LABELS}.
|
||||
*
|
||||
* @see ResourceManagerAdministrationProtocol#replaceLabelsOnNode
|
||||
* @param newNodeLabelsName the list of new labels
|
||||
* @param hsr the servlet request
|
||||
* @param nodeId the node we want to replace the node labels
|
||||
* @return Response containing the status code
|
||||
* @throws Exception if an exception happened
|
||||
*/
|
||||
Response replaceLabelsOnNode(Set<String> newNodeLabelsName,
|
||||
HttpServletRequest hsr, String nodeId) throws Exception;
|
||||
|
||||
/**
|
||||
* This method retrieves all the node labels in the cluster, and it is
|
||||
* reachable by using {@link RMWSConsts#GET_NODE_LABELS}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getClusterNodeLabels
|
||||
* @param hsr the servlet request
|
||||
* @return all the node labels in the cluster
|
||||
* @throws IOException if an IOException happened
|
||||
*/
|
||||
NodeLabelsInfo getClusterNodeLabels(HttpServletRequest hsr)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* This method adds specific node labels for specific nodes, and it is
|
||||
* reachable by using {@link RMWSConsts#ADD_NODE_LABELS}.
|
||||
*
|
||||
* @see ResourceManagerAdministrationProtocol#addToClusterNodeLabels
|
||||
* @param newNodeLabels the node labels to add
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws Exception in case of bad request
|
||||
*/
|
||||
Response addToClusterNodeLabels(NodeLabelsInfo newNodeLabels,
|
||||
HttpServletRequest hsr) throws Exception;
|
||||
|
||||
/**
|
||||
* This method removes all the node labels for specific nodes, and it is
|
||||
* reachable by using {@link RMWSConsts#REMOVE_NODE_LABELS}.
|
||||
*
|
||||
* @see ResourceManagerAdministrationProtocol#removeFromClusterNodeLabels
|
||||
* @param oldNodeLabels the node labels to remove
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws Exception in case of bad request
|
||||
*/
|
||||
Response removeFromCluserNodeLabels(Set<String> oldNodeLabels,
|
||||
HttpServletRequest hsr) throws Exception;
|
||||
|
||||
/**
|
||||
* This method retrieves all the node labels for specific node, and it is
|
||||
* reachable by using {@link RMWSConsts#NODES_NODEID_GETLABELS}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param nodeId the node we want to get all the node labels
|
||||
* @return all the labels for a specific node.
|
||||
* @throws IOException if an IOException happened
|
||||
*/
|
||||
NodeLabelsInfo getLabelsOnNode(HttpServletRequest hsr, String nodeId)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* This method retrieves the priority for a specific app, and it is reachable
|
||||
* by using {@link RMWSConsts#APPS_APPID_PRIORITY}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param appId the app we want to get the priority
|
||||
* @return the priority for a specific application
|
||||
* @throws AuthorizationException in case of the user is not authorized
|
||||
*/
|
||||
AppPriority getAppPriority(HttpServletRequest hsr, String appId)
|
||||
throws AuthorizationException;
|
||||
|
||||
/**
|
||||
* This method updates the priority for a specific application, and it is
|
||||
* reachable by using {@link RMWSConsts#APPS_APPID_PRIORITY}.
|
||||
*
|
||||
* @param targetPriority the priority we want to set for the app
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to update its priority
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authenticated
|
||||
* @throws YarnException if the target is null
|
||||
* @throws IOException if the update fails.
|
||||
* @throws InterruptedException if interrupted.
|
||||
*/
|
||||
Response updateApplicationPriority(AppPriority targetPriority,
|
||||
HttpServletRequest hsr, String appId) throws AuthorizationException,
|
||||
YarnException, InterruptedException, IOException;
|
||||
|
||||
/**
|
||||
* This method retrieves the queue for a specific app, and it is reachable by
|
||||
* using {@link RMWSConsts#APPS_APPID_QUEUE}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to retrieve its queue
|
||||
* @return the Queue for a specific application.
|
||||
* @throws AuthorizationException if the user is not authenticated
|
||||
*/
|
||||
AppQueue getAppQueue(HttpServletRequest hsr, String appId)
|
||||
throws AuthorizationException;
|
||||
|
||||
/**
|
||||
* This method updates the queue for a specific application, and it is
|
||||
* reachable by using {@link RMWSConsts#APPS_APPID_QUEUE}.
|
||||
*
|
||||
* @param targetQueue the queue we want to set
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to change its queue
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authenticated
|
||||
* @throws YarnException if the app is not found
|
||||
* @throws IOException if the update fails.
|
||||
* @throws InterruptedException if interrupted.
|
||||
*/
|
||||
Response updateAppQueue(AppQueue targetQueue, HttpServletRequest hsr,
|
||||
String appId) throws AuthorizationException, YarnException,
|
||||
InterruptedException, IOException;
|
||||
|
||||
/**
|
||||
* Generates a new ApplicationId which is then sent to the client. This method
|
||||
* is reachable by using {@link RMWSConsts#APPS_NEW_APPLICATION}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getNewApplication
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the app id and the maximum resource
|
||||
* capabilities
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method
|
||||
* @throws IOException if the creation fails
|
||||
* @throws InterruptedException if interrupted
|
||||
*/
|
||||
Response createNewApplication(HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Function to submit an app to the RM. This method is reachable by using
|
||||
* {@link RMWSConsts#APPS}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#submitApplication
|
||||
*
|
||||
* @param newApp structure containing information to construct the
|
||||
* ApplicationSubmissionContext
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method
|
||||
* @throws IOException if the submission failed
|
||||
* @throws InterruptedException if interrupted
|
||||
*/
|
||||
Response submitApplication(ApplicationSubmissionContextInfo newApp,
|
||||
HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
* This method posts a delegation token from the client, and it is reachable
|
||||
* by using {@link RMWSConsts#DELEGATION_TOKEN}.
|
||||
*
|
||||
* @see ApplicationBaseProtocol#getDelegationToken
|
||||
* @param tokenData the token to delegate
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if Kerberos auth failed
|
||||
* @throws IOException if the delegation failed
|
||||
* @throws InterruptedException if interrupted
|
||||
* @throws Exception in case of bad request
|
||||
*/
|
||||
Response postDelegationToken(DelegationToken tokenData,
|
||||
HttpServletRequest hsr) throws AuthorizationException, IOException,
|
||||
InterruptedException, Exception;
|
||||
|
||||
/**
|
||||
* This method updates the expiration for a delegation token from the client,
|
||||
* and it is reachable by using
|
||||
* {@link RMWSConsts#DELEGATION_TOKEN_EXPIRATION}.
|
||||
*
|
||||
* @see ApplicationBaseProtocol#renewDelegationToken
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if Kerberos auth failed
|
||||
* @throws IOException if the delegation failed
|
||||
* @throws Exception in case of bad request
|
||||
*/
|
||||
Response postDelegationTokenExpiration(HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, Exception;
|
||||
|
||||
/**
|
||||
* This method cancel the delegation token from the client, and it is
|
||||
* reachable by using {@link RMWSConsts#DELEGATION_TOKEN}.
|
||||
*
|
||||
* @see ApplicationBaseProtocol#cancelDelegationToken
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if Kerberos auth failed
|
||||
* @throws IOException if the delegation failed
|
||||
* @throws InterruptedException if interrupted
|
||||
* @throws Exception in case of bad request
|
||||
*/
|
||||
Response cancelDelegationToken(HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException,
|
||||
Exception;
|
||||
|
||||
/**
|
||||
* Generates a new ReservationId which is then sent to the client. This method
|
||||
* is reachable by using {@link RMWSConsts#RESERVATION_NEW}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#getNewReservation
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the app id and the maximum resource
|
||||
* capabilities
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method.
|
||||
* @throws IOException if creation failed
|
||||
* @throws InterruptedException if interrupted
|
||||
*/
|
||||
Response createNewReservation(HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Function to submit a Reservation to the RM.This method is reachable by
|
||||
* using {@link RMWSConsts#RESERVATION_SUBMIT}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#submitReservation
|
||||
*
|
||||
* @param resContext provides information to construct the
|
||||
* ReservationSubmissionRequest
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method
|
||||
* @throws IOException if creation failed
|
||||
* @throws InterruptedException if interrupted
|
||||
*/
|
||||
Response submitReservation(ReservationSubmissionRequestInfo resContext,
|
||||
HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Function to update a Reservation to the RM. This method is reachable by
|
||||
* using {@link RMWSConsts#RESERVATION_UPDATE}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#updateReservation
|
||||
*
|
||||
* @param resContext provides information to construct the
|
||||
* ReservationUpdateRequest
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method
|
||||
* @throws IOException if the operation failed
|
||||
* @throws InterruptedException if interrupted
|
||||
*/
|
||||
Response updateReservation(ReservationUpdateRequestInfo resContext,
|
||||
HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Function to delete a Reservation to the RM. This method is reachable by
|
||||
* using {@link RMWSConsts#RESERVATION_DELETE}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#deleteReservation
|
||||
*
|
||||
* @param resContext provides information to construct the
|
||||
* ReservationDeleteRequest
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException when the user group information cannot be
|
||||
* retrieved.
|
||||
* @throws IOException when a {@link ReservationDeleteRequest} cannot be
|
||||
* created from the {@link ReservationDeleteRequestInfo}. This
|
||||
* exception is also thrown on
|
||||
* {@code ClientRMService.deleteReservation} invokation failure.
|
||||
* @throws InterruptedException if doAs action throws an InterruptedException.
|
||||
*/
|
||||
Response deleteReservation(ReservationDeleteRequestInfo resContext,
|
||||
HttpServletRequest hsr)
|
||||
throws AuthorizationException, IOException, InterruptedException;
|
||||
|
||||
/**
|
||||
* Function to retrieve a list of all the reservations. This method is
|
||||
* reachable by using {@link RMWSConsts#RESERVATION_LIST}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#listReservations
|
||||
* @param queue filter the result by queue
|
||||
* @param reservationId filter the result by reservationId
|
||||
* @param startTime filter the result by start time
|
||||
* @param endTime filter the result by end time
|
||||
* @param includeResourceAllocations true if the resource allocation should be
|
||||
* in the result, false otherwise
|
||||
* @param hsr the servlet request
|
||||
* @return Response containing the status code
|
||||
* @throws Exception in case of bad request
|
||||
*/
|
||||
Response listReservation(String queue, String reservationId, long startTime,
|
||||
long endTime, boolean includeResourceAllocations, HttpServletRequest hsr)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* This method retrieves the timeout information for a specific app with a
|
||||
* specific type, and it is reachable by using
|
||||
* {@link RMWSConsts#APPS_TIMEOUTS_TYPE}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to get the timeout
|
||||
* @param type the type of the timeouts
|
||||
* @return the timeout for a specific application with a specific type.
|
||||
* @throws AuthorizationException if the user is not authorized
|
||||
*/
|
||||
AppTimeoutInfo getAppTimeout(HttpServletRequest hsr, String appId,
|
||||
String type) throws AuthorizationException;
|
||||
|
||||
/**
|
||||
* This method retrieves the timeout information for a specific app, and it is
|
||||
* reachable by using {@link RMWSConsts#APPS_TIMEOUTS}.
|
||||
*
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to get the timeouts
|
||||
* @return the timeouts for a specific application
|
||||
* @throws AuthorizationException if the user is not authorized
|
||||
*/
|
||||
AppTimeoutsInfo getAppTimeouts(HttpServletRequest hsr, String appId)
|
||||
throws AuthorizationException;
|
||||
|
||||
/**
|
||||
* This method updates the timeout information for a specific app, and it is
|
||||
* reachable by using {@link RMWSConsts#APPS_TIMEOUT}.
|
||||
*
|
||||
* @see ApplicationClientProtocol#updateApplicationTimeouts
|
||||
* @param appTimeout the appTimeoutInfo
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to update
|
||||
* @return Response containing the status code
|
||||
* @throws AuthorizationException if the user is not authorized to invoke this
|
||||
* method
|
||||
* @throws YarnException in case of bad request
|
||||
* @throws IOException if the operation failed
|
||||
* @throws InterruptedException if interrupted
|
||||
*/
|
||||
Response updateApplicationTimeout(AppTimeoutInfo appTimeout,
|
||||
HttpServletRequest hsr, String appId) throws AuthorizationException,
|
||||
YarnException, InterruptedException, IOException;
|
||||
|
||||
/**
|
||||
* This method retrieves all the attempts information for a specific app, and
|
||||
* it is reachable by using {@link RMWSConsts#APPS_APPID_APPATTEMPTS}.
|
||||
*
|
||||
* @see ApplicationBaseProtocol#getApplicationAttempts
|
||||
* @param hsr the servlet request
|
||||
* @param appId the application we want to get the attempts
|
||||
* @return all the attempts info for a specific application
|
||||
*/
|
||||
AppAttemptsInfo getAppAttempts(HttpServletRequest hsr, String appId);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user