From 2accda38a1e8d658ed1f6da4a583a81a151e17b4 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Tue, 10 Apr 2012 20:36:09 +0000 Subject: [PATCH] MAPREDUCE-4017. Add jobname to jobsummary log (tgraves and Koji Noguchi via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1311972 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../mapreduce/jobhistory/JobHistoryEventHandler.java | 1 + .../hadoop/mapreduce/jobhistory/JobSummary.java | 12 +++++++++++- .../mapreduce/v2/hs/TestJobHistoryParsing.java | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 55778b5cf5..b73e16431b 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -298,6 +298,9 @@ Release 0.23.3 - UNRELEASED MAPREDUCE-4099. ApplicationMaster may fail to remove staging directory (Jason Lowe via bobby) + MAPREDUCE-4017. Add jobname to jobsummary log (tgraves and Koji Noguchi + via bobby) + Release 0.23.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java index 953ef447b6..01073cb34f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java @@ -551,6 +551,7 @@ public void processEventForJobSummary(HistoryEvent event, JobSummary summary, summary.setUser(jse.getUserName()); summary.setQueue(jse.getJobQueueName()); summary.setJobSubmitTime(jse.getSubmitTime()); + summary.setJobName(jse.getJobName()); break; case NORMALIZED_RESOURCE: NormalizedResourceEvent normalizedResourceEvent = diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobSummary.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobSummary.java index 691c7ee4e1..5adfed15a9 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobSummary.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobSummary.java @@ -45,6 +45,7 @@ public class JobSummary { private long mapSlotSeconds; // TODO Not generated yet in MRV2 private long reduceSlotSeconds; // TODO Not generated yet MRV2 // private int clusterSlotCapacity; + private String jobName; JobSummary() { } @@ -185,6 +186,14 @@ public void setReduceSlotSeconds(long reduceSlotSeconds) { this.reduceSlotSeconds = reduceSlotSeconds; } + public String getJobName() { + return jobName; + } + + public void setJobName(String jobName) { + this.jobName = jobName; + } + public String getJobSummaryString() { SummaryBuilder summary = new SummaryBuilder() .add("jobId", jobId) @@ -201,7 +210,8 @@ public String getJobSummaryString() { .add("queue", queue) .add("status", jobStatus) .add("mapSlotSeconds", mapSlotSeconds) - .add("reduceSlotSeconds", reduceSlotSeconds); + .add("reduceSlotSeconds", reduceSlotSeconds) + .add("jobName", jobName); return summary.toString(); } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java index 2b0d8965ec..7aab4de0dc 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestJobHistoryParsing.java @@ -267,6 +267,8 @@ public HistoryEvent answer(InvocationOnMock invocation) Assert.assertEquals("JobId does not match", jobId.toString(), jobSummaryElements.get("jobId")); + Assert.assertEquals("JobName does not match", "test", + jobSummaryElements.get("jobName")); Assert.assertTrue("submitTime should not be 0", Long.parseLong(jobSummaryElements.get("submitTime")) != 0); Assert.assertTrue("launchTime should not be 0",