Merge -c 1185887 from trunk to branch-0.23 to complete fix for MAPREDUCE-3165.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1185888 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a990576916
commit
dfb1c18558
|
@ -1621,6 +1621,9 @@ Release 0.23.0 - Unreleased
|
||||||
MAPREDUCE-2762. Cleanup MR staging directory on completion. (mahadev via
|
MAPREDUCE-2762. Cleanup MR staging directory on completion. (mahadev via
|
||||||
acmurthy)
|
acmurthy)
|
||||||
|
|
||||||
|
MAPREDUCE-3165. Ensure logging options are set correctly for MR AM and
|
||||||
|
tasks. (todd via acmurthy)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.mapred.TaskLog.LogName;
|
import org.apache.hadoop.mapred.TaskLog.LogName;
|
||||||
import org.apache.hadoop.mapreduce.ID;
|
import org.apache.hadoop.mapreduce.ID;
|
||||||
import org.apache.hadoop.mapreduce.MRJobConfig;
|
import org.apache.hadoop.mapreduce.MRJobConfig;
|
||||||
|
import org.apache.hadoop.mapreduce.v2.util.MRApps;
|
||||||
import org.apache.hadoop.yarn.util.Apps;
|
import org.apache.hadoop.yarn.util.Apps;
|
||||||
import org.apache.hadoop.yarn.api.ApplicationConstants;
|
import org.apache.hadoop.yarn.api.ApplicationConstants;
|
||||||
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
|
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
|
||||||
|
@ -93,7 +94,9 @@ public class MapReduceChildJVM {
|
||||||
MRJobConfig.DEFAULT_MAPRED_ADMIN_USER_ENV)
|
MRJobConfig.DEFAULT_MAPRED_ADMIN_USER_ENV)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set logging level
|
// Set logging level in the environment.
|
||||||
|
// This is so that, if the child forks another "bin/hadoop" (common in
|
||||||
|
// streaming) it will have the correct loglevel.
|
||||||
environment.put(
|
environment.put(
|
||||||
"HADOOP_ROOT_LOGGER",
|
"HADOOP_ROOT_LOGGER",
|
||||||
getChildLogLevel(conf, task.isMapTask()) + ",CLA");
|
getChildLogLevel(conf, task.isMapTask()) + ",CLA");
|
||||||
|
@ -110,7 +113,7 @@ public class MapReduceChildJVM {
|
||||||
// properties.
|
// properties.
|
||||||
long logSize = TaskLog.getTaskLogLength(conf);
|
long logSize = TaskLog.getTaskLogLength(conf);
|
||||||
Vector<String> logProps = new Vector<String>(4);
|
Vector<String> logProps = new Vector<String>(4);
|
||||||
setupLog4jProperties(logProps, logSize);
|
setupLog4jProperties(task, logProps, logSize);
|
||||||
Iterator<String> it = logProps.iterator();
|
Iterator<String> it = logProps.iterator();
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -163,11 +166,11 @@ public class MapReduceChildJVM {
|
||||||
return adminClasspath + " " + userClasspath;
|
return adminClasspath + " " + userClasspath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupLog4jProperties(Vector<String> vargs,
|
private static void setupLog4jProperties(Task task,
|
||||||
|
Vector<String> vargs,
|
||||||
long logSize) {
|
long logSize) {
|
||||||
vargs.add("-Dlog4j.configuration=container-log4j.properties");
|
String logLevel = getChildLogLevel(task.conf, task.isMapTask());
|
||||||
vargs.add("-D" + MRJobConfig.TASK_LOG_DIR + "=" + ApplicationConstants.LOG_DIR_EXPANSION_VAR);
|
MRApps.addLog4jSystemProperties(logLevel, logSize, vargs);
|
||||||
vargs.add("-D" + MRJobConfig.TASK_LOG_SIZE + "=" + logSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getVMCommand(
|
public static List<String> getVMCommand(
|
||||||
|
@ -222,7 +225,7 @@ public class MapReduceChildJVM {
|
||||||
|
|
||||||
// Setup the log4j prop
|
// Setup the log4j prop
|
||||||
long logSize = TaskLog.getTaskLogLength(conf);
|
long logSize = TaskLog.getTaskLogLength(conf);
|
||||||
setupLog4jProperties(vargs, logSize);
|
setupLog4jProperties(task, vargs, logSize);
|
||||||
|
|
||||||
if (conf.getProfileEnabled()) {
|
if (conf.getProfileEnabled()) {
|
||||||
if (conf.getProfileTaskRange(task.isMapTask()
|
if (conf.getProfileTaskRange(task.isMapTask()
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId;
|
||||||
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState;
|
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState;
|
||||||
import org.apache.hadoop.mapreduce.v2.api.records.TaskId;
|
import org.apache.hadoop.mapreduce.v2.api.records.TaskId;
|
||||||
import org.apache.hadoop.mapreduce.v2.api.records.TaskType;
|
import org.apache.hadoop.mapreduce.v2.api.records.TaskType;
|
||||||
|
import org.apache.hadoop.yarn.ContainerLogAppender;
|
||||||
import org.apache.hadoop.yarn.YarnException;
|
import org.apache.hadoop.yarn.YarnException;
|
||||||
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
|
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
|
||||||
import org.apache.hadoop.yarn.api.ApplicationConstants;
|
import org.apache.hadoop.yarn.api.ApplicationConstants;
|
||||||
|
@ -340,4 +341,19 @@ public class MRApps extends Apps {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the JVM system properties necessary to configure {@link ContainerLogAppender}.
|
||||||
|
* @param logLevel the desired log level (eg INFO/WARN/DEBUG)
|
||||||
|
* @param logSize See {@link ContainerLogAppender#setTotalLogFileSize(long)}
|
||||||
|
* @param vargs the argument list to append to
|
||||||
|
*/
|
||||||
|
public static void addLog4jSystemProperties(
|
||||||
|
String logLevel, long logSize, List<String> vargs) {
|
||||||
|
vargs.add("-Dlog4j.configuration=container-log4j.properties");
|
||||||
|
vargs.add("-D" + MRJobConfig.TASK_LOG_DIR + "=" +
|
||||||
|
ApplicationConstants.LOG_DIR_EXPANSION_VAR);
|
||||||
|
vargs.add("-D" + MRJobConfig.TASK_LOG_SIZE + "=" + logSize);
|
||||||
|
vargs.add("-Dhadoop.root.logger=" + logLevel + ",CLA");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,9 +326,9 @@ public interface MRJobConfig {
|
||||||
public static final String DEFAULT_MR_AM_COMMAND_OPTS = "-Xmx1536m";
|
public static final String DEFAULT_MR_AM_COMMAND_OPTS = "-Xmx1536m";
|
||||||
|
|
||||||
/** Root Logging level passed to the MR app master.*/
|
/** Root Logging level passed to the MR app master.*/
|
||||||
public static final String MR_AM_LOG_OPTS =
|
public static final String MR_AM_LOG_LEVEL =
|
||||||
MR_AM_PREFIX+"log-opts";
|
MR_AM_PREFIX+"log.level";
|
||||||
public static final String DEFAULT_MR_AM_LOG_OPTS = "INFO";
|
public static final String DEFAULT_MR_AM_LOG_LEVEL = "INFO";
|
||||||
|
|
||||||
/**The number of splits when reporting progress in MR*/
|
/**The number of splits when reporting progress in MR*/
|
||||||
public static final String MR_AM_NUM_PROGRESS_SPLITS =
|
public static final String MR_AM_NUM_PROGRESS_SPLITS =
|
||||||
|
@ -439,8 +439,9 @@ public interface MRJobConfig {
|
||||||
|
|
||||||
public static final String HADOOP_WORK_DIR = "HADOOP_WORK_DIR";
|
public static final String HADOOP_WORK_DIR = "HADOOP_WORK_DIR";
|
||||||
|
|
||||||
|
// Environment variables used by Pipes. (TODO: these
|
||||||
|
// do not appear to be used by current pipes source code!)
|
||||||
public static final String STDOUT_LOGFILE_ENV = "STDOUT_LOGFILE_ENV";
|
public static final String STDOUT_LOGFILE_ENV = "STDOUT_LOGFILE_ENV";
|
||||||
|
|
||||||
public static final String STDERR_LOGFILE_ENV = "STDERR_LOGFILE_ENV";
|
public static final String STDERR_LOGFILE_ENV = "STDERR_LOGFILE_ENV";
|
||||||
|
|
||||||
// This should be the directory where splits file gets localized on the node
|
// This should be the directory where splits file gets localized on the node
|
||||||
|
|
|
@ -20,7 +20,9 @@ package org.apache.hadoop.mapred;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
@ -320,14 +322,14 @@ public class YARNRunner implements ClientProtocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the command to run the AM
|
// Setup the command to run the AM
|
||||||
Vector<CharSequence> vargs = new Vector<CharSequence>(8);
|
List<String> vargs = new ArrayList<String>(8);
|
||||||
vargs.add(Environment.JAVA_HOME.$() + "/bin/java");
|
vargs.add(Environment.JAVA_HOME.$() + "/bin/java");
|
||||||
|
|
||||||
|
// TODO: why do we use 'conf' some places and 'jobConf' others?
|
||||||
long logSize = TaskLog.getTaskLogLength(new JobConf(conf));
|
long logSize = TaskLog.getTaskLogLength(new JobConf(conf));
|
||||||
vargs.add("-Dlog4j.configuration=container-log4j.properties");
|
String logLevel = jobConf.get(
|
||||||
vargs.add("-D" + MRJobConfig.TASK_LOG_DIR + "="
|
MRJobConfig.MR_AM_LOG_LEVEL, MRJobConfig.DEFAULT_MR_AM_LOG_LEVEL);
|
||||||
+ ApplicationConstants.LOG_DIR_EXPANSION_VAR);
|
MRApps.addLog4jSystemProperties(logLevel, logSize, vargs);
|
||||||
vargs.add("-D" + MRJobConfig.TASK_LOG_SIZE + "=" + logSize);
|
|
||||||
|
|
||||||
vargs.add(conf.get(MRJobConfig.MR_AM_COMMAND_OPTS,
|
vargs.add(conf.get(MRJobConfig.MR_AM_COMMAND_OPTS,
|
||||||
MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS));
|
MRJobConfig.DEFAULT_MR_AM_COMMAND_OPTS));
|
||||||
|
|
Loading…
Reference in New Issue