Class YarnClientUtils

java.lang.Object
org.apache.hadoop.yarn.client.util.YarnClientUtils

public abstract class YarnClientUtils extends Object
This class is a container for utility methods that are useful when creating YARN clients.
  • Field Details

  • Constructor Details

    • YarnClientUtils

      public YarnClientUtils()
  • Method Details

    • getRmPrincipal

      public static String getRmPrincipal(org.apache.hadoop.conf.Configuration conf) throws IOException
      Look up and return the resource manager's principal. This method automatically does the _HOST replacement in the principal and correctly handles HA resource manager configurations.
      Parameters:
      conf - the Configuration file from which to read the principal
      Returns:
      the resource manager's principal string or null if the YarnConfiguration.RM_PRINCIPAL property is not set in the conf parameter
      Throws:
      IOException - thrown if there's an error replacing the host name
    • getRmPrincipal

      public static String getRmPrincipal(String rmPrincipal, org.apache.hadoop.conf.Configuration conf) throws IOException
      Perform the _HOST replacement in the principal, Returning the result. Correctly handles HA resource manager configurations.
      Parameters:
      rmPrincipal - the principal string to prepare
      conf - the configuration
      Returns:
      the prepared principal string
      Throws:
      IOException - thrown if there's an error replacing the host name
    • buildNodeLabelsFromStr

      public static List<org.apache.hadoop.yarn.api.records.NodeLabel> buildNodeLabelsFromStr(String args)
      Creates node labels from string
      Parameters:
      args - nodelabels string to be parsed
      Returns:
      list of node labels
    • generateToken

      public static String generateToken(String server) throws IOException, InterruptedException
      Generate SPNEGO challenge request token.
      Parameters:
      server - - hostname to contact
      Returns:
      SPNEGO token challenge
      Throws:
      IOException - thrown if doAs failed
      InterruptedException - thrown if doAs is interrupted
    • isYarnFederationEnabled

      public static boolean isYarnFederationEnabled(org.apache.hadoop.conf.Configuration conf)