Class RouterCLI
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.yarn.client.cli.RouterCLI
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
public class RouterCLI
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.util.Tool
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final Stringprotected static final Stringprotected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfosprotected static final Stringprotected static final Stringprotected static final Stringprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final Stringprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final Stringprotected static final Stringprotected static final Stringprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final Stringprotected static final Stringprotected static final Stringprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final Stringprotected static final Stringprotected static final Stringprotected static final org.apache.hadoop.ha.HAAdmin.UsageInfoprotected static final Stringprotected static final Stringprotected static final Stringprotected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfosprotected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocolstatic org.apache.hadoop.ha.HAAdmin.UsageInfoprotected inthandDeletePolicy(String queue) Delete queue weight information.protected inthandListPolicies(int pageSize, int currentPage, String queue, List<String> queues) Handles the list federation policies based on the specified parameters.static voidprotected List<org.apache.hadoop.yarn.server.api.protocolrecords.FederationQueueWeight>parsePoliciesByXml(String policiesXml) Parse FederationQueueWeight from the xml configuration file.protected org.apache.hadoop.yarn.server.api.protocolrecords.SaveFederationQueuePolicyRequestparsePolicy(String policy) We will parse the policy, and it has specific formatting requirements. 1. queue,router weight,amrm weight,headroomalphaFederationQueueWeight. 2. the sum of weights for all sub-clusters in routerWeight/amrmWeight should be 1.protected intparseXml2PoliciesAndBatchSavePolicies(String policiesXml) Parse Policies from XML and save them in batches to FederationStateStore.intMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
DEREGISTER_SUBCLUSTER_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo DEREGISTER_SUBCLUSTER_USAGE -
DEREGISTER_SUBCLUSTER_EXAMPLE_1
- See Also:
-
DEREGISTER_SUBCLUSTER_EXAMPLE_2
- See Also:
-
DEREGISTER_SUBCLUSTER_HELP_INFO
- See Also:
-
GET_SUBCLUSTER_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo GET_SUBCLUSTER_USAGE -
GET_SUBCLUSTER_EXAMPLE
- See Also:
-
SUBCLUSTER_USAGEINFOS
protected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos SUBCLUSTER_USAGEINFOS -
POLICY_SAVE_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo POLICY_SAVE_USAGE -
POLICY_SAVE_USAGE_EXAMPLE_DESC
- See Also:
-
POLICY_SAVE_USAGE_EXAMPLE_1
- See Also:
-
POLICY_SAVE_USAGE_EXAMPLE_2
- See Also:
-
POLICY_BATCH_SAVE_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo POLICY_BATCH_SAVE_USAGE -
POLICY_BATCH_SAVE_USAGE_EXAMPLE_DESC
- See Also:
-
POLICY_BATCH_SAVE_USAGE_EXAMPLE_1
- See Also:
-
POLICY_BATCH_SAVE_USAGE_EXAMPLE_2
- See Also:
-
POLICY_LIST_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo POLICY_LIST_USAGE -
POLICY_LIST_USAGE_EXAMPLE_DESC
- See Also:
-
POLICY_LIST_USAGE_EXAMPLE_1
- See Also:
-
POLICY_LIST_USAGE_EXAMPLE_2
- See Also:
-
POLICY_DELETE_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo POLICY_DELETE_USAGE -
POLICY_DELETE_USAGE_EXAMPLE_DESC
- See Also:
-
POLICY_DELETE_USAGE_EXAMPLE1
- See Also:
-
POLICY_DELETE_USAGE_EXAMPLE2
- See Also:
-
POLICY_USAGEINFOS
protected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos POLICY_USAGEINFOS -
APPLICATION_DELETE_USAGE
protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo APPLICATION_DELETE_USAGE -
APPLICATION_DELETE_USAGE_EXAMPLE_DESC
- See Also:
-
APPLICATION_DELETE_USAGE_EXAMPLE_1
- See Also:
-
APPLICATION_USAGEINFOS
protected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos APPLICATION_USAGEINFOS -
ADMIN_USAGE
-
-
Constructor Details
-
RouterCLI
public RouterCLI() -
RouterCLI
public RouterCLI(org.apache.hadoop.conf.Configuration conf)
-
-
Method Details
-
createAdminProtocol
protected org.apache.hadoop.yarn.server.api.ResourceManagerAdministrationProtocol createAdminProtocol() throws IOException- Throws:
IOException
-
parsePolicy
protected org.apache.hadoop.yarn.server.api.protocolrecords.SaveFederationQueuePolicyRequest parsePolicy(String policy) throws org.apache.hadoop.yarn.exceptions.YarnException We will parse the policy, and it has specific formatting requirements. 1. queue,router weight,amrm weight,headroomalphaFederationQueueWeight. 2. the sum of weights for all sub-clusters in routerWeight/amrmWeight should be 1.- Parameters:
policy- queue weight.- Returns:
- If the conversion is correct, we will get the FederationQueueWeight, otherwise an exception will be thrown.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- exceptions from yarn servers.
-
parseXml2PoliciesAndBatchSavePolicies
Parse Policies from XML and save them in batches to FederationStateStore. We save 20 policies in one batch. If the user needs to save 1000 policies, it will cycle 50 times. Every time a page is saved, we will print whether a page has been saved successfully or failed.- Parameters:
policiesXml- Policies Xml Path.- Returns:
- 0, success; 1, failed.
-
parsePoliciesByXml
protected List<org.apache.hadoop.yarn.server.api.protocolrecords.FederationQueueWeight> parsePoliciesByXml(String policiesXml) throws IOException, SAXException, ParserConfigurationException Parse FederationQueueWeight from the xml configuration file.We allow users to provide an xml configuration file, which stores the weight information of the queue.
- Parameters:
policiesXml- Policies Xml Path.- Returns:
- FederationQueueWeight List.
- Throws:
IOException- an I/O exception of some sort has occurred.SAXException- Encapsulate a general SAX error or warning.ParserConfigurationException- a serious configuration error..
-
handListPolicies
Handles the list federation policies based on the specified parameters.- Parameters:
pageSize- Records displayed per page.currentPage- The current page number.queue- The name of the queue to be filtered.queues- list of queues to filter.- Returns:
- 0, success; 1, failed.
-
handDeletePolicy
Delete queue weight information.- Parameters:
queue- Queue whose policy needs to be deleted.- Returns:
- 0, success; 1, failed.
-
run
- Specified by:
runin interfaceorg.apache.hadoop.util.Tool- Throws:
Exception
-
getPolicyBatchSaveUsage
public static org.apache.hadoop.ha.HAAdmin.UsageInfo getPolicyBatchSaveUsage() -
main
- Throws:
Exception
-
getAdminUsage
-