You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by vi...@apache.org on 2011/10/07 13:35:18 UTC
svn commit: r1180007 - in /hadoop/common/trunk/hadoop-mapreduce-project:
CHANGES.txt
hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java
Author: vinodkv
Date: Fri Oct 7 11:35:17 2011
New Revision: 1180007
URL: http://svn.apache.org/viewvc?rev=1180007&view=rev
Log:
MAPREDUCE-3141. Fix the broken MRAppMaster to work over YARN in security mode.(vinodkv)
Modified:
hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java
Modified: hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt?rev=1180007&r1=1180006&r2=1180007&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt Fri Oct 7 11:35:17 2011
@@ -1537,6 +1537,9 @@ Release 0.23.0 - Unreleased
MAPREDUCE-2783. Fixing RM web-UI to show no tracking-URL when AM
crashes. (Eric Payne via vinodkv)
+ MAPREDUCE-3141. Fix the broken MRAppMaster to work over YARN in security
+ mode.(vinodkv)
+
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java?rev=1180007&r1=1180006&r2=1180007&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java Fri Oct 7 11:35:17 2011
@@ -131,7 +131,9 @@ public class MRAppMaster extends Composi
private JobEventDispatcher jobEventDispatcher;
private Job job;
-
+ private Credentials fsTokens = new Credentials(); // Filled during init
+ private UserGroupInformation currentUser; // Will be setup during init
+
public MRAppMaster(ApplicationAttemptId applicationAttemptId) {
this(applicationAttemptId, new SystemClock());
}
@@ -146,6 +148,9 @@ public class MRAppMaster extends Composi
@Override
public void init(final Configuration conf) {
+
+ downloadTokensAndSetupUGI(conf);
+
context = new RunningAppContext(conf);
// Job name is the same as the app name util we support DAG of jobs
@@ -226,37 +231,6 @@ public class MRAppMaster extends Composi
/** Create and initialize (but don't start) a single job. */
protected Job createJob(Configuration conf) {
- // ////////// Obtain the tokens needed by the job. //////////
- Credentials fsTokens = new Credentials();
- UserGroupInformation currentUser = null;
-
- try {
- currentUser = UserGroupInformation.getCurrentUser();
-
- if (UserGroupInformation.isSecurityEnabled()) {
- // Read the file-system tokens from the localized tokens-file.
- Path jobSubmitDir =
- FileContext.getLocalFSFileContext().makeQualified(
- new Path(new File(MRJobConfig.JOB_SUBMIT_DIR)
- .getAbsolutePath()));
- Path jobTokenFile =
- new Path(jobSubmitDir, MRJobConfig.APPLICATION_TOKENS_FILE);
- fsTokens.addAll(Credentials.readTokenStorageFile(jobTokenFile, conf));
- LOG.info("jobSubmitDir=" + jobSubmitDir + " jobTokenFile="
- + jobTokenFile);
-
- for (Token<? extends TokenIdentifier> tk : fsTokens.getAllTokens()) {
- LOG.info(" --- DEBUG: Token of kind " + tk.getKind()
- + "in current ugi in the AppMaster for service "
- + tk.getService());
- currentUser.addToken(tk); // For use by AppMaster itself.
- }
- }
- } catch (IOException e) {
- throw new YarnException(e);
- }
- // ////////// End of obtaining the tokens needed by the job. //////////
-
// create single job
Job newJob = new JobImpl(appAttemptID, conf, dispatcher.getEventHandler(),
taskAttemptListener, jobTokenSecretManager, fsTokens, clock,
@@ -297,6 +271,42 @@ public class MRAppMaster extends Composi
return newJob;
} // end createJob()
+
+ /**
+ * Obtain the tokens needed by the job and put them in the UGI
+ * @param conf
+ */
+ protected void downloadTokensAndSetupUGI(Configuration conf) {
+
+ try {
+ this.currentUser = UserGroupInformation.getCurrentUser();
+
+ if (UserGroupInformation.isSecurityEnabled()) {
+ // Read the file-system tokens from the localized tokens-file.
+ Path jobSubmitDir =
+ FileContext.getLocalFSFileContext().makeQualified(
+ new Path(new File(MRJobConfig.JOB_SUBMIT_DIR)
+ .getAbsolutePath()));
+ Path jobTokenFile =
+ new Path(jobSubmitDir, MRJobConfig.APPLICATION_TOKENS_FILE);
+ fsTokens.addAll(Credentials.readTokenStorageFile(jobTokenFile, conf));
+ LOG.info("jobSubmitDir=" + jobSubmitDir + " jobTokenFile="
+ + jobTokenFile);
+
+ for (Token<? extends TokenIdentifier> tk : fsTokens.getAllTokens()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Token of kind " + tk.getKind()
+ + "in current ugi in the AppMaster for service "
+ + tk.getService());
+ }
+ currentUser.addToken(tk); // For use by AppMaster itself.
+ }
+ }
+ } catch (IOException e) {
+ throw new YarnException(e);
+ }
+ }
+
protected void addIfService(Object object) {
if (object instanceof Service) {
addService((Service) object);