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 Details

    • DEREGISTER_SUBCLUSTER_USAGE

      protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo DEREGISTER_SUBCLUSTER_USAGE
    • DEREGISTER_SUBCLUSTER_EXAMPLE_1

      protected static final String DEREGISTER_SUBCLUSTER_EXAMPLE_1
      See Also:
    • DEREGISTER_SUBCLUSTER_EXAMPLE_2

      protected static final String DEREGISTER_SUBCLUSTER_EXAMPLE_2
      See Also:
    • DEREGISTER_SUBCLUSTER_HELP_INFO

      protected static final String DEREGISTER_SUBCLUSTER_HELP_INFO
      See Also:
    • GET_SUBCLUSTER_USAGE

      protected static final org.apache.hadoop.ha.HAAdmin.UsageInfo GET_SUBCLUSTER_USAGE
    • GET_SUBCLUSTER_EXAMPLE

      protected static final String 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

      protected static final String POLICY_SAVE_USAGE_EXAMPLE_DESC
      See Also:
    • POLICY_SAVE_USAGE_EXAMPLE_1

      protected static final String POLICY_SAVE_USAGE_EXAMPLE_1
      See Also:
    • POLICY_SAVE_USAGE_EXAMPLE_2

      protected static final String 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

      protected static final String POLICY_BATCH_SAVE_USAGE_EXAMPLE_DESC
      See Also:
    • POLICY_BATCH_SAVE_USAGE_EXAMPLE_1

      protected static final String POLICY_BATCH_SAVE_USAGE_EXAMPLE_1
      See Also:
    • POLICY_BATCH_SAVE_USAGE_EXAMPLE_2

      protected static final String 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

      protected static final String POLICY_LIST_USAGE_EXAMPLE_DESC
      See Also:
    • POLICY_LIST_USAGE_EXAMPLE_1

      protected static final String POLICY_LIST_USAGE_EXAMPLE_1
      See Also:
    • POLICY_LIST_USAGE_EXAMPLE_2

      protected static final String 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

      protected static final String POLICY_DELETE_USAGE_EXAMPLE_DESC
      See Also:
    • POLICY_DELETE_USAGE_EXAMPLE1

      protected static final String POLICY_DELETE_USAGE_EXAMPLE1
      See Also:
    • POLICY_DELETE_USAGE_EXAMPLE2

      protected static final String 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

      protected static final String APPLICATION_DELETE_USAGE_EXAMPLE_DESC
      See Also:
    • APPLICATION_DELETE_USAGE_EXAMPLE_1

      protected static final String APPLICATION_DELETE_USAGE_EXAMPLE_1
      See Also:
    • APPLICATION_USAGEINFOS

      protected static final org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos APPLICATION_USAGEINFOS
    • ADMIN_USAGE

      protected static final Map<String,org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos> 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,headroomalpha FederationQueueWeight. 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

      protected int parseXml2PoliciesAndBatchSavePolicies(String policiesXml)
      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

      protected int handListPolicies(int pageSize, int currentPage, String queue, List<String> queues)
      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

      protected int handDeletePolicy(String queue)
      Delete queue weight information.
      Parameters:
      queue - Queue whose policy needs to be deleted.
      Returns:
      0, success; 1, failed.
    • run

      public int run(String[] args) throws Exception
      Specified by:
      run in interface org.apache.hadoop.util.Tool
      Throws:
      Exception
    • getPolicyBatchSaveUsage

      public static org.apache.hadoop.ha.HAAdmin.UsageInfo getPolicyBatchSaveUsage()
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • getAdminUsage

      @VisibleForTesting public Map<String,org.apache.hadoop.yarn.client.cli.RouterCLI.RouterCmdUsageInfos> getAdminUsage()