Class MRApps
java.lang.Object
org.apache.hadoop.yarn.util.Apps
org.apache.hadoop.mapreduce.v2.util.MRApps
@Private
@Unstable
public class MRApps
extends org.apache.hadoop.yarn.util.Apps
Helper class for MR applications
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
FieldsFields inherited from class org.apache.hadoop.yarn.util.Apps
APP, ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddLog4jSystemProperties(org.apache.hadoop.mapred.Task task, List<String> vargs, org.apache.hadoop.conf.Configuration conf) Add the JVM system properties necessary to configureContainerLogAppenderorContainerRollingLogAppender.static voidaddToEnvironment(Map<String, String> environment, String variable, String value, org.apache.hadoop.conf.Configuration conf) static ClassLoadercreateJobClassLoader(org.apache.hadoop.conf.Configuration conf) Creates aApplicationClassLoaderifMRJobConfig.MAPREDUCE_JOB_CLASSLOADERis set to true, and the APP_CLASSPATH environment variable is set.static StringcrossPlatformifyMREnv(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.api.ApplicationConstants.Environment env) static StringgetChildLogLevel(org.apache.hadoop.conf.Configuration conf, boolean isMap) static org.apache.hadoop.fs.PathgetEndJobCommitFailureFile(org.apache.hadoop.conf.Configuration conf, String user, JobId jobId) static org.apache.hadoop.fs.PathgetEndJobCommitSuccessFile(org.apache.hadoop.conf.Configuration conf, String user, JobId jobId) static StringgetJobFile(org.apache.hadoop.conf.Configuration conf, String user, org.apache.hadoop.mapreduce.JobID jobId) static org.apache.hadoop.fs.PathgetStagingAreaDir(org.apache.hadoop.conf.Configuration conf, String user) static org.apache.hadoop.fs.PathgetStartJobCommitFile(org.apache.hadoop.conf.Configuration conf, String user, JobId jobId) static StringgetSystemPropertiesToLog(org.apache.hadoop.conf.Configuration conf) Return lines for system property keys and values per configuration.static voidsetClassLoader(ClassLoader classLoader, org.apache.hadoop.conf.Configuration conf) Sets the provided classloader on the given configuration and as the thread context classloader if the classloader is not null.static voidsetClasspath(Map<String, String> environment, org.apache.hadoop.conf.Configuration conf) static voidsetEnvFromInputProperty(Map<String, String> env, String propName, String defaultPropValue, org.apache.hadoop.conf.Configuration conf) static voidsetEnvFromInputString(Map<String, String> env, String envString, org.apache.hadoop.conf.Configuration conf) static voidsetJobClassLoader(org.apache.hadoop.conf.Configuration conf) Creates and sets aApplicationClassLoaderon the given configuration and as the thread context classloader, ifMRJobConfig.MAPREDUCE_JOB_CLASSLOADERis set to true, and the APP_CLASSPATH environment variable is set.static voidsetupDistributedCache(org.apache.hadoop.conf.Configuration conf, Map<String, org.apache.hadoop.yarn.api.records.LocalResource> localResources) static voidsetupDistributedCacheLocal(org.apache.hadoop.conf.Configuration conf) Set up the DistributedCache related configs to makeJobContextImpl.getLocalCacheFiles(Configuration)andJobContextImpl.getLocalCacheArchives(Configuration)working.static MRApps.TaskAttemptStateUItaskAttemptState(String attemptStateStr) static MRApps.TaskStateUIstatic StringtaskSymbol(TaskType type) static TaskTypestatic JobIdstatic Stringstatic StringtoString(TaskAttemptId taid) static Stringstatic TaskAttemptIdtoTaskAttemptID(String taid) static TaskIdMethods inherited from class org.apache.hadoop.yarn.util.Apps
addToEnvironment, addToEnvironment, crossPlatformify, getEnvVarsFromInputProperty, isApplicationFinalState, setEnvFromInputProperty, setEnvFromInputString, setEnvFromInputString, shouldCountTowardsNodeBlacklisting, shouldHaveNext, throwParseException, toAppID, toAppID
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
MRApps
public MRApps()
-
-
Method Details
-
toString
-
toJobID
-
toString
-
toTaskID
-
toString
-
toTaskAttemptID
-
taskSymbol
-
taskType
-
taskAttemptState
-
taskState
-
setClasspath
public static void setClasspath(Map<String, String> environment, org.apache.hadoop.conf.Configuration conf) throws IOException- Throws:
IOException
-
setJobClassLoader
Creates and sets aApplicationClassLoaderon the given configuration and as the thread context classloader, ifMRJobConfig.MAPREDUCE_JOB_CLASSLOADERis set to true, and the APP_CLASSPATH environment variable is set.- Parameters:
conf-- Throws:
IOException
-
createJobClassLoader
public static ClassLoader createJobClassLoader(org.apache.hadoop.conf.Configuration conf) throws IOException Creates aApplicationClassLoaderifMRJobConfig.MAPREDUCE_JOB_CLASSLOADERis set to true, and the APP_CLASSPATH environment variable is set.- Parameters:
conf-- Returns:
- the created job classloader, or null if the job classloader is not enabled or the APP_CLASSPATH environment variable is not set
- Throws:
IOException
-
setClassLoader
public static void setClassLoader(ClassLoader classLoader, org.apache.hadoop.conf.Configuration conf) Sets the provided classloader on the given configuration and as the thread context classloader if the classloader is not null.- Parameters:
classLoader-conf-
-
getStagingAreaDir
public static org.apache.hadoop.fs.Path getStagingAreaDir(org.apache.hadoop.conf.Configuration conf, String user) -
getJobFile
-
getEndJobCommitSuccessFile
-
getEndJobCommitFailureFile
-
getStartJobCommitFile
-
setupDistributedCache
public static void setupDistributedCache(org.apache.hadoop.conf.Configuration conf, Map<String, org.apache.hadoop.yarn.api.records.LocalResource> localResources) throws IOException- Throws:
IOException
-
setupDistributedCacheLocal
public static void setupDistributedCacheLocal(org.apache.hadoop.conf.Configuration conf) throws IOException Set up the DistributedCache related configs to makeJobContextImpl.getLocalCacheFiles(Configuration)andJobContextImpl.getLocalCacheArchives(Configuration)working.- Parameters:
conf-- Throws:
IOException
-
getChildLogLevel
-
addLog4jSystemProperties
public static void addLog4jSystemProperties(org.apache.hadoop.mapred.Task task, List<String> vargs, org.apache.hadoop.conf.Configuration conf) Add the JVM system properties necessary to configureContainerLogAppenderorContainerRollingLogAppender.- Parameters:
task- for map/reduce, or null for app mastervargs- the argument list to append toconf- configuration of MR job
-
getSystemPropertiesToLog
Return lines for system property keys and values per configuration.- Returns:
- the formatted string for the system property lines or null if no properties are specified.
-
setEnvFromInputString
-
setEnvFromInputProperty
-
addToEnvironment
-
crossPlatformifyMREnv
public static String crossPlatformifyMREnv(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.yarn.api.ApplicationConstants.Environment env)
-