diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java index c6ffe08bf1..06be989b9e 100644 --- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java +++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/OutputCommitterContextImpl.java @@ -41,7 +41,9 @@ public OutputCommitterContextImpl(ApplicationId applicationId, int dagAttemptNumber, String dagName, String vertexName, - int dagIdentifier, int vertexIdx, RootInputLeafOutput output) { + int dagIdentifier, + int vertexIdx, + RootInputLeafOutput output) { Objects.requireNonNull(applicationId, "applicationId is null"); Objects.requireNonNull(dagName, "dagName is null"); Objects.requireNonNull(vertexName, "vertexName is null"); diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/committer/MROutputCommitter.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/committer/MROutputCommitter.java index 5afb4e0e43..4a648dc901 100644 --- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/committer/MROutputCommitter.java +++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/committer/MROutputCommitter.java @@ -79,9 +79,7 @@ public void initialize() throws IOException { jobConf.getCredentials().mergeAll(UserGroupInformation.getCurrentUser().getCredentials()); jobConf.setInt(MRJobConfig.APPLICATION_ATTEMPT_ID, getContext().getDAGAttemptNumber()); - jobConf.set(MRJobConfig.JOB_COMMITTER_UUID, Utils.getDAGID( - getContext().getApplicationId(), - getContext().getDagIdentifier())); + jobConf.set(MRJobConfig.JOB_COMMITTER_UUID, Utils.getDAGID(getContext())); jobConf.setInt(MRJobConfig.VERTEX_ID, getContext().getVertexIndex()); committer = getOutputCommitter(getContext()); jobContext = getJobContextFromVertexContext(getContext()); diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/common/Utils.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/common/Utils.java index 21e9f1ae4b..4fa0365850 100644 --- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/common/Utils.java +++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/common/Utils.java @@ -33,6 +33,8 @@ import org.apache.tez.common.counters.TezCounter; import org.apache.tez.dag.records.TezDAGID; import org.apache.tez.mapreduce.hadoop.mapred.MRCounters; +import org.apache.tez.runtime.api.OutputCommitterContext; +import org.apache.tez.runtime.api.OutputContext; @Private public final class Utils { @@ -66,7 +68,11 @@ public static Counter getMRCounter(TezCounter tezCounter) { return new MRCounters.MRCounter(tezCounter); } - public static String getDAGID(ApplicationId id, int dagIdentifier) { - return TezDAGID.getInstance(id, dagIdentifier).toString(); + public static String getDAGID(OutputCommitterContext context) { + return TezDAGID.getInstance(context.getApplicationId(), context.getDagIdentifier()).toString(); + } + + public static String getDAGID(OutputContext context) { + return TezDAGID.getInstance(context.getApplicationId(), context.getDagIdentifier()).toString(); } } diff --git a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/output/MROutput.java b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/output/MROutput.java index 91ec9ac797..b8ac1b3a54 100644 --- a/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/output/MROutput.java +++ b/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/output/MROutput.java @@ -414,8 +414,7 @@ protected List initializeBase() throws IOException, InterruptedException } jobConf.setInt(MRJobConfig.APPLICATION_ATTEMPT_ID, getContext().getDAGAttemptNumber()); - jobConf.set(MRJobConfig.JOB_COMMITTER_UUID, Utils.getDAGID(getContext().getApplicationId(), - getContext().getDagIdentifier())); + jobConf.set(MRJobConfig.JOB_COMMITTER_UUID, Utils.getDAGID(getContext())); TaskAttemptID taskAttemptId = org.apache.tez.mapreduce.hadoop.mapreduce.TaskAttemptContextImpl .createMockTaskAttemptID(getContext().getApplicationId().getClusterTimestamp(), getContext().getTaskVertexIndex(), getContext().getApplicationId().getId(), diff --git a/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/output/TestMROutput.java b/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/output/TestMROutput.java index 27b72aac7c..3359a6eda2 100644 --- a/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/output/TestMROutput.java +++ b/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/output/TestMROutput.java @@ -150,7 +150,7 @@ public void testJobUUIDSet() throws Exception { String dagID = output.jobConf.get(MRJobConfig.JOB_COMMITTER_UUID, invalidDAGID); assertNotEquals(dagID, invalidDAGID); assertNotEquals(output.jobConf.get(org.apache.hadoop.mapred.JobContext.TASK_ATTEMPT_ID), dagID); - assertEquals(dagID, Utils.getDAGID(outputContext.getApplicationId(), outputContext.getDagIdentifier())); + assertEquals(dagID, Utils.getDAGID(outputContext)); } @Test(timeout = 5000)