From 7b3a98cfcd0eb729b1971b3e5607a1d7755fdb07 Mon Sep 17 00:00:00 2001 From: Ravi Gummadi Date: Wed, 21 Mar 2012 09:42:23 +0000 Subject: [PATCH] MAPREDUCE-3953. [Gridmix] Gridmix throws NPE and does not simulate a job if the trace contains null taskStatus for a task.(ravigummadi) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1303330 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 4 ++++ .../java/org/apache/hadoop/mapred/gridmix/JobFactory.java | 8 +++++++- .../java/org/apache/hadoop/tools/rumen/ZombieJob.java | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index d5993698de..9686d88769 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -52,6 +52,10 @@ Trunk (unreleased changes) BUG FIXES + MAPREDUCE-3953. [Gridmix] Gridmix throws NPE and does not simulate a + job if the trace contains null taskStatus for a task. + (ravigummadi) + MAPREDUCE-3829. [Gridmix] Gridmix should give better error message when input data directory already exists and -generate opton is given.(ravigummadi) diff --git a/hadoop-mapreduce-project/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobFactory.java b/hadoop-mapreduce-project/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobFactory.java index f5404e842f..427174295c 100644 --- a/hadoop-mapreduce-project/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobFactory.java +++ b/hadoop-mapreduce-project/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/JobFactory.java @@ -215,7 +215,13 @@ protected JobStory getNextJobFiltered() throws IOException { return null == job ? null : new FilterJobStory(job) { @Override public TaskInfo getTaskInfo(TaskType taskType, int taskNumber) { - return new MinTaskInfo(this.job.getTaskInfo(taskType, taskNumber)); + TaskInfo info = this.job.getTaskInfo(taskType, taskNumber); + if (info != null) { + info = new MinTaskInfo(info); + } else { + info = new MinTaskInfo(new TaskInfo(0, 0, 0, 0, 0)); + } + return info; } }; } diff --git a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ZombieJob.java b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ZombieJob.java index fa9378cad4..3857e1fea9 100644 --- a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ZombieJob.java +++ b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ZombieJob.java @@ -638,6 +638,9 @@ private TaskAttemptInfo getTaskAttemptInfo(LoggedTask loggedTask, } private TaskInfo getTaskInfo(LoggedTask loggedTask) { + if (loggedTask == null) { + return new TaskInfo(0, 0, 0, 0, 0); + } List attempts = loggedTask.getAttempts(); long inputBytes = -1;