Class YarnClientUtils
java.lang.Object
org.apache.hadoop.yarn.client.util.YarnClientUtils
This class is a container for utility methods that are useful when creating
YARN clients.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.apache.hadoop.yarn.api.records.NodeLabel>buildNodeLabelsFromStr(String args) Creates node labels from stringstatic StringgenerateToken(String server) Generate SPNEGO challenge request token.static StringgetRmPrincipal(String rmPrincipal, org.apache.hadoop.conf.Configuration conf) Perform the_HOSTreplacement in theprincipal, Returning the result.static StringgetRmPrincipal(org.apache.hadoop.conf.Configuration conf) Look up and return the resource manager's principal.static booleanisYarnFederationEnabled(org.apache.hadoop.conf.Configuration conf)
-
Field Details
-
NO_LABEL_ERR_MSG
- See Also:
-
-
Constructor Details
-
YarnClientUtils
public YarnClientUtils()
-
-
Method Details
-
getRmPrincipal
Look up and return the resource manager's principal. This method automatically does the_HOSTreplacement in the principal and correctly handles HA resource manager configurations.- Parameters:
conf- theConfigurationfile from which to read the principal- Returns:
- the resource manager's principal string or null if the
YarnConfiguration.RM_PRINCIPALproperty is not set in theconfparameter - 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_HOSTreplacement in theprincipal, Returning the result. Correctly handles HA resource manager configurations.- Parameters:
rmPrincipal- the principal string to prepareconf- 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
Generate SPNEGO challenge request token.- Parameters:
server- - hostname to contact- Returns:
- SPNEGO token challenge
- Throws:
IOException- thrown if doAs failedInterruptedException- thrown if doAs is interrupted
-
isYarnFederationEnabled
public static boolean isYarnFederationEnabled(org.apache.hadoop.conf.Configuration conf)
-