Skip to content

Commit 37e4b78

Browse files
author
Alejandro Abdelnur
committed
MAPREDUCE-5379. Include token tracking ids in jobconf. (kkambatl via tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1-beta@1523608 13f79535-47bb-0310-9956-ffa450edef68
1 parent aa1037d commit 37e4b78

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

hadoop-mapreduce-project/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Release 2.1.1-beta - UNRELEASED
1515
but just before ClientService to avoid race conditions during RM restart.
1616
(Jian He via vinodkv)
1717

18+
MAPREDUCE-5379. Include token tracking ids in jobconf. (kkambatl via tucu)
19+
1820
OPTIMIZATIONS
1921

2022
MAPREDUCE-5446. TestJobHistoryEvents and TestJobHistoryParsing have race

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.net.URISyntaxException;
2525
import java.net.UnknownHostException;
2626
import java.security.NoSuchAlgorithmException;
27+
import java.util.ArrayList;
2728
import java.util.Arrays;
2829
import java.util.Comparator;
2930
import java.util.List;
@@ -56,6 +57,7 @@
5657
import org.apache.hadoop.security.UserGroupInformation;
5758
import org.apache.hadoop.security.authorize.AccessControlList;
5859
import org.apache.hadoop.security.token.Token;
60+
import org.apache.hadoop.security.token.TokenIdentifier;
5961
import org.apache.hadoop.util.ReflectionUtils;
6062
import org.codehaus.jackson.JsonParseException;
6163
import org.codehaus.jackson.map.JsonMappingException;
@@ -405,6 +407,19 @@ JobStatus submitJobInternal(Job job, Cluster cluster)
405407
// different job.
406408
TokenCache.cleanUpTokenReferral(conf);
407409

410+
if (conf.getBoolean(
411+
MRJobConfig.JOB_TOKEN_TRACKING_IDS_ENABLED,
412+
MRJobConfig.DEFAULT_JOB_TOKEN_TRACKING_IDS_ENABLED)) {
413+
// Add HDFS tracking ids
414+
ArrayList<String> trackingIds = new ArrayList<String>();
415+
for (Token<? extends TokenIdentifier> t :
416+
job.getCredentials().getAllTokens()) {
417+
trackingIds.add(t.decodeIdentifier().getTrackingId());
418+
}
419+
conf.setStrings(MRJobConfig.JOB_TOKEN_TRACKING_IDS,
420+
trackingIds.toArray(new String[trackingIds.size()]));
421+
}
422+
408423
// Write job file to submit dir
409424
writeConf(conf, submitJobFile);
410425

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ public interface MRJobConfig {
308308
public static final String MAPREDUCE_JOB_CREDENTIALS_BINARY =
309309
"mapreduce.job.credentials.binary";
310310

311+
/* Configs for tracking ids of tokens used by a job */
312+
public static final String JOB_TOKEN_TRACKING_IDS_ENABLED =
313+
"mapreduce.job.token.tracking.ids.enabled";
314+
public static final boolean DEFAULT_JOB_TOKEN_TRACKING_IDS_ENABLED = false;
315+
public static final String JOB_TOKEN_TRACKING_IDS =
316+
"mapreduce.job.token.tracking.ids";
317+
311318
public static final String JOB_SUBMITHOST =
312319
"mapreduce.job.submithostname";
313320
public static final String JOB_SUBMITHOSTADDR =

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,23 @@
11301130
</description>
11311131
</property>
11321132

1133+
<property>
1134+
<name>mapreduce.job.token.tracking.ids.enabled</name>
1135+
<value>false</value>
1136+
<description>Whether to write tracking ids of tokens to
1137+
job-conf. When true, the configuration property
1138+
"mapreduce.job.token.tracking.ids" is set to the token-tracking-ids of
1139+
the job</description>
1140+
</property>
1141+
1142+
<property>
1143+
<name>mapreduce.job.token.tracking.ids</name>
1144+
<value></value>
1145+
<description>When mapreduce.job.token.tracking.ids.enabled is
1146+
set to true, this is set by the framework to the
1147+
token-tracking-ids used by the job.</description>
1148+
</property>
1149+
11331150
<property>
11341151
<name>mapreduce.task.merge.progress.records</name>
11351152
<value>10000</value>

0 commit comments

Comments
 (0)