hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r816052 [5/5] - in /hadoop/mapreduce/trunk: ./ src/contrib/capacity-scheduler/ src/contrib/capacity-scheduler/src/test/org/apache/hadoop/mapred/ src/contrib/fairscheduler/ src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/ src/con...
Date Thu, 17 Sep 2009 05:04:27 GMT
Modified: hadoop/mapreduce/trunk/src/webapps/job/analysejobhistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/analysejobhistory.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/analysejobhistory.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/analysejobhistory.jsp Thu Sep 17 05:04:21 2009
@@ -26,7 +26,7 @@
   import="org.apache.hadoop.fs.*"
   import="org.apache.hadoop.util.*"
   import="java.text.SimpleDateFormat"
-  import="org.apache.hadoop.mapred.JobHistory.*"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
 %>
 
 <%!	private static SimpleDateFormat dateFormat 
@@ -38,93 +38,96 @@
 <%
   String jobid = request.getParameter("jobid");
   String logFile = request.getParameter("logFile");
-  String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
   String numTasks = request.getParameter("numTasks");
   int showTasks = 10 ; 
   if (numTasks != null) {
     showTasks = Integer.parseInt(numTasks);  
   }
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
-  JobInfo job = JSPUtil.getJobInfo(request, fs);
+  JobHistoryParser.JobInfo job = JSPUtil.getJobInfo(request, fs);
 %>
-<h2>Hadoop Job <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=encodedLogFileName%>"><%=jobid %> </a></h2>
-<b>User : </b> <%=job.get(Keys.USER) %><br/> 
-<b>JobName : </b> <%=job.get(Keys.JOBNAME) %><br/> 
-<b>JobConf : </b> <%=job.get(Keys.JOBCONF) %><br/> 
-<b>Submitted At : </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.SUBMIT_TIME), 0 ) %><br/> 
-<b>Launched At : </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.LAUNCH_TIME), job.getLong(Keys.SUBMIT_TIME)) %><br/>
-<b>Finished At : </b>  <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.FINISH_TIME), job.getLong(Keys.LAUNCH_TIME)) %><br/>
-<b>Status : </b> <%= ((job.get(Keys.JOB_STATUS) == null)?"Incomplete" :job.get(Keys.JOB_STATUS)) %><br/> 
+<h2>Hadoop Job <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=logFile%>"><%=jobid %> </a></h2>
+<b>User : </b> <%=job.getUsername() %><br/> 
+<b>JobName : </b> <%=job.getJobname() %><br/> 
+<b>JobConf : </b> <%=job.getJobConfPath() %><br/> 
+<b>Submitted At : </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getSubmitTime(), 0 ) %><br/> 
+<b>Launched At : </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLaunchTime(), job.getSubmitTime()) %><br/>
+<b>Finished At : </b>  <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getFinishTime(), job.getLaunchTime()) %><br/>
+<b>Status : </b> <%= ((job.getJobStatus() == null)?"Incomplete" :job.getJobStatus()) %><br/> 
 <hr/>
 <center>
 <%
-  if (!Values.SUCCESS.name().equals(job.get(Keys.JOB_STATUS))) {
+  if (!JobStatus.getJobRunState(JobStatus.SUCCEEDED).equals(job.getJobStatus())) {
     out.print("<h3>No Analysis available as job did not finish</h3>");
     return;
   }
-  Map<String, JobHistory.Task> tasks = job.getAllTasks();
-  int finishedMaps = job.getInt(Keys.FINISHED_MAPS)  ;
-  int finishedReduces = job.getInt(Keys.FINISHED_REDUCES) ;
-  JobHistory.Task [] mapTasks = new JobHistory.Task[finishedMaps]; 
-  JobHistory.Task [] reduceTasks = new JobHistory.Task[finishedReduces]; 
-  int mapIndex = 0 , reduceIndex=0; 
-  long avgMapTime = 0;
-  long avgReduceTime = 0;
-  long avgShuffleTime = 0;
-
-  for (JobHistory.Task task : tasks.values()) {
-    Map<String, TaskAttempt> attempts = task.getTaskAttempts();
-    for (JobHistory.TaskAttempt attempt : attempts.values()) {
-      if (attempt.get(Keys.TASK_STATUS).equals(Values.SUCCESS.name())) {
-        long avgFinishTime = (attempt.getLong(Keys.FINISH_TIME) -
-      		                attempt.getLong(Keys.START_TIME));
-        if (Values.MAP.name().equals(task.get(Keys.TASK_TYPE))) {
-          mapTasks[mapIndex++] = attempt ; 
-          avgMapTime += avgFinishTime;
-        } else if (Values.REDUCE.name().equals(task.get(Keys.TASK_TYPE))) { 
-          reduceTasks[reduceIndex++] = attempt;
-          avgShuffleTime += (attempt.getLong(Keys.SHUFFLE_FINISHED) - 
-                             attempt.getLong(Keys.START_TIME));
-          avgReduceTime += (attempt.getLong(Keys.FINISH_TIME) -
-                            attempt.getLong(Keys.SHUFFLE_FINISHED));
-        }
-        break;
-      }
+  
+  HistoryViewer.AnalyzedJob avg = new HistoryViewer.AnalyzedJob(job);
+  JobHistoryParser.TaskAttemptInfo [] mapTasks = avg.getMapTasks();
+  JobHistoryParser.TaskAttemptInfo [] reduceTasks = avg.getReduceTasks();
+
+  Comparator<JobHistoryParser.TaskAttemptInfo> cMap = 
+    new Comparator<JobHistoryParser.TaskAttemptInfo>() {
+    public int compare(JobHistoryParser.TaskAttemptInfo t1, 
+        JobHistoryParser.TaskAttemptInfo t2) {
+      long l1 = t1.getFinishTime() - t1.getStartTime();
+      long l2 = t2.getFinishTime() - t2.getStartTime();
+      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
-  }
-	 
-  if (finishedMaps > 0) {
-    avgMapTime /= finishedMaps;
-  }
-  if (finishedReduces > 0) {
-    avgReduceTime /= finishedReduces;
-    avgShuffleTime /= finishedReduces;
-  }
-  Comparator<JobHistory.Task> cMap = new Comparator<JobHistory.Task>(){
-    public int compare(JobHistory.Task t1, JobHistory.Task t2){
-      long l1 = t1.getLong(Keys.FINISH_TIME) - t1.getLong(Keys.START_TIME); 
-      long l2 = t2.getLong(Keys.FINISH_TIME) - t2.getLong(Keys.START_TIME);
-      return (l2<l1 ? -1 : (l2==l1 ? 0 : 1));
+  };
+
+  Comparator<JobHistoryParser.TaskAttemptInfo> cShuffle = 
+    new Comparator<JobHistoryParser.TaskAttemptInfo>() {
+    public int compare(JobHistoryParser.TaskAttemptInfo t1, 
+        JobHistoryParser.TaskAttemptInfo t2) {
+      long l1 = t1.getShuffleFinishTime() - t1.getStartTime();
+      long l2 = t2.getShuffleFinishTime() - t2.getStartTime();
+      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
-  }; 
-  Comparator<JobHistory.Task> cShuffle = new Comparator<JobHistory.Task>(){
-    public int compare(JobHistory.Task t1, JobHistory.Task t2){
-      long l1 = t1.getLong(Keys.SHUFFLE_FINISHED) - 
-                t1.getLong(Keys.START_TIME); 
-      long l2 = t2.getLong(Keys.SHUFFLE_FINISHED) - 
-                t2.getLong(Keys.START_TIME); 
-      return (l2<l1 ? -1 : (l2==l1 ? 0 : 1));
+  };
+
+  Comparator<JobHistoryParser.TaskAttemptInfo> cFinishShuffle = 
+    new Comparator<JobHistoryParser.TaskAttemptInfo>() {
+    public int compare(JobHistoryParser.TaskAttemptInfo t1, 
+        JobHistoryParser.TaskAttemptInfo t2) {
+      long l1 = t1.getShuffleFinishTime(); 
+      long l2 = t2.getShuffleFinishTime();
+      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    }
+  };
+
+  Comparator<JobHistoryParser.TaskAttemptInfo> cFinishMapRed = 
+    new Comparator<JobHistoryParser.TaskAttemptInfo>() {
+    public int compare(JobHistoryParser.TaskAttemptInfo t1, 
+        JobHistoryParser.TaskAttemptInfo t2) {
+      long l1 = t1.getFinishTime(); 
+      long l2 = t2.getFinishTime();
+      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    }
+  };
+  
+  Comparator<JobHistoryParser.TaskAttemptInfo> cReduce = 
+    new Comparator<JobHistoryParser.TaskAttemptInfo>() {
+    public int compare(JobHistoryParser.TaskAttemptInfo t1, 
+        JobHistoryParser.TaskAttemptInfo t2) {
+      long l1 = t1.getFinishTime() -
+                t1.getShuffleFinishTime();
+      long l2 = t2.getFinishTime() -
+                t2.getShuffleFinishTime();
+      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
   }; 
+
+  if (mapTasks == null || mapTasks.length <= 0) return;
   Arrays.sort(mapTasks, cMap);
-  JobHistory.Task minMap = mapTasks[mapTasks.length-1] ;
+  JobHistoryParser.TaskAttemptInfo minMap = mapTasks[mapTasks.length-1] ;
 %>
 
 <h3>Time taken by best performing Map task 
-<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=minMap.get(Keys.TASKID)%>">
-<%=minMap.get(Keys.TASKID) %></a> : <%=StringUtils.formatTimeDiff(minMap.getLong(Keys.FINISH_TIME), minMap.getLong(Keys.START_TIME) ) %></h3>
+<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=minMap.getAttemptId().getTaskID()%>">
+<%=minMap.getAttemptId().getTaskID() %></a> : <%=StringUtils.formatTimeDiff(minMap.getFinishTime(), minMap.getStartTime() ) %></h3>
 <h3>Average time taken by Map tasks: 
-<%=StringUtils.formatTimeDiff(avgMapTime, 0) %></h3>
+<%=StringUtils.formatTimeDiff(avg.getAvgMapTime(), 0) %></h3>
 <h3>Worse performing map tasks</h3>
 <table border="2" cellpadding="5" cellspacing="2">
 <tr><td>Task Id</td><td>Time taken</td></tr>
@@ -132,48 +135,40 @@
   for (int i=0;i<showTasks && i<mapTasks.length; i++) {
 %>
     <tr>
-    <td><a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=mapTasks[i].get(Keys.TASKID)%>">
-        <%=mapTasks[i].get(Keys.TASKID) %></a></td>
-    <td><%=StringUtils.formatTimeDiff(mapTasks[i].getLong(Keys.FINISH_TIME), mapTasks[i].getLong(Keys.START_TIME)) %></td>
+    <td><a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=mapTasks[i].getAttemptId().getTaskID()%>">
+        <%=mapTasks[i].getAttemptId().getTaskID() %></a></td>
+    <td><%=StringUtils.formatTimeDiff(mapTasks[i].getFinishTime(), mapTasks[i].getStartTime()) %></td>
     </tr>
 <%
   }
 %>
 </table>
 <%  
-  Comparator<JobHistory.Task> cFinishMapRed = 
-    new Comparator<JobHistory.Task>() {
-    public int compare(JobHistory.Task t1, JobHistory.Task t2){
-      long l1 = t1.getLong(Keys.FINISH_TIME); 
-      long l2 = t2.getLong(Keys.FINISH_TIME);
-      return (l2<l1 ? -1 : (l2==l1 ? 0 : 1));
-    }
-  };
   Arrays.sort(mapTasks, cFinishMapRed);
-  JobHistory.Task lastMap = mapTasks[0] ;
+  JobHistoryParser.TaskAttemptInfo lastMap = mapTasks[0] ;
 %>
 
 <h3>The last Map task 
-<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>
-&taskid=<%=lastMap.get(Keys.TASKID)%>"><%=lastMap.get(Keys.TASKID) %></a> 
+<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>
+&taskid=<%=lastMap.getAttemptId().getTaskID()%>"><%=lastMap.getAttemptId().getTaskID() %></a> 
 finished at (relative to the Job launch time): 
 <%=StringUtils.getFormattedTimeWithDiff(dateFormat, 
-                              lastMap.getLong(Keys.FINISH_TIME), 
-                              job.getLong(Keys.LAUNCH_TIME) ) %></h3>
+                              lastMap.getFinishTime(), 
+                              job.getLaunchTime()) %></h3>
 <hr/>
 
 <%
   if (reduceTasks.length <= 0) return;
   Arrays.sort(reduceTasks, cShuffle); 
-  JobHistory.Task minShuffle = reduceTasks[reduceTasks.length-1] ;
+  JobHistoryParser.TaskAttemptInfo minShuffle = reduceTasks[reduceTasks.length-1] ;
 %>
 <h3>Time taken by best performing shuffle
-<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>
-&taskid=<%=minShuffle.get(Keys.TASKID)%>"><%=minShuffle.get(Keys.TASKID)%></a> : 
-<%=StringUtils.formatTimeDiff(minShuffle.getLong(Keys.SHUFFLE_FINISHED), 
-                              minShuffle.getLong(Keys.START_TIME) ) %></h3>
+<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>
+&taskid=<%=minShuffle.getAttemptId().getTaskID()%>"><%=minShuffle.getAttemptId().getTaskID()%></a> : 
+<%=StringUtils.formatTimeDiff(minShuffle.getShuffleFinishTime(),
+                              minShuffle.getStartTime() ) %></h3>
 <h3>Average time taken by Shuffle: 
-<%=StringUtils.formatTimeDiff(avgShuffleTime, 0) %></h3>
+<%=StringUtils.formatTimeDiff(avg.getAvgShuffleTime(), 0) %></h3>
 <h3>Worse performing Shuffle(s)</h3>
 <table border="2" cellpadding="5" cellspacing="2">
 <tr><td>Task Id</td><td>Time taken</td></tr>
@@ -182,12 +177,12 @@
 %>
     <tr>
     <td><a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=
-<%=encodedLogFileName%>&taskid=<%=reduceTasks[i].get(Keys.TASKID)%>">
-<%=reduceTasks[i].get(Keys.TASKID) %></a></td>
+<%=logFile%>&taskid=<%=reduceTasks[i].getAttemptId().getTaskID()%>">
+<%=reduceTasks[i].getAttemptId().getTaskID() %></a></td>
     <td><%=
            StringUtils.formatTimeDiff(
-                       reduceTasks[i].getLong(Keys.SHUFFLE_FINISHED),
-                       reduceTasks[i].getLong(Keys.START_TIME)) %>
+                       reduceTasks[i].getShuffleFinishTime(),
+                       reduceTasks[i].getStartTime()) %>
     </td>
     </tr>
 <%
@@ -195,48 +190,31 @@
 %>
 </table>
 <%  
-  Comparator<JobHistory.Task> cFinishShuffle = 
-    new Comparator<JobHistory.Task>() {
-    public int compare(JobHistory.Task t1, JobHistory.Task t2){
-      long l1 = t1.getLong(Keys.SHUFFLE_FINISHED); 
-      long l2 = t2.getLong(Keys.SHUFFLE_FINISHED);
-      return (l2<l1 ? -1 : (l2==l1 ? 0 : 1));
-    }
-  };
   Arrays.sort(reduceTasks, cFinishShuffle);
-  JobHistory.Task lastShuffle = reduceTasks[0] ;
+  JobHistoryParser.TaskAttemptInfo lastShuffle = reduceTasks[0] ;
 %>
 
 <h3>The last Shuffle  
-<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>
-&taskid=<%=lastShuffle.get(Keys.TASKID)%>"><%=lastShuffle.get(Keys.TASKID)%>
+<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>
+&taskid=<%=lastShuffle.getAttemptId().getTaskID()%>"><%=lastShuffle.getAttemptId().getTaskID()%>
 </a> finished at (relative to the Job launch time): 
 <%=StringUtils.getFormattedTimeWithDiff(dateFormat,
-                              lastShuffle.getLong(Keys.SHUFFLE_FINISHED), 
-                              job.getLong(Keys.LAUNCH_TIME) ) %></h3>
+                              lastShuffle.getShuffleFinishTime(),
+                              job.getLaunchTime() ) %></h3>
 
 <%
-  Comparator<JobHistory.Task> cReduce = new Comparator<JobHistory.Task>(){
-    public int compare(JobHistory.Task t1, JobHistory.Task t2){
-      long l1 = t1.getLong(Keys.FINISH_TIME) - 
-                t1.getLong(Keys.SHUFFLE_FINISHED); 
-      long l2 = t2.getLong(Keys.FINISH_TIME) - 
-                t2.getLong(Keys.SHUFFLE_FINISHED);
-      return (l2<l1 ? -1 : (l2==l1 ? 0 : 1));
-    }
-  }; 
   Arrays.sort(reduceTasks, cReduce); 
-  JobHistory.Task minReduce = reduceTasks[reduceTasks.length-1] ;
+  JobHistoryParser.TaskAttemptInfo minReduce = reduceTasks[reduceTasks.length-1] ;
 %>
 <hr/>
 <h3>Time taken by best performing Reduce task : 
-<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=minReduce.get(Keys.TASKID)%>">
-<%=minReduce.get(Keys.TASKID) %></a> : 
-<%=StringUtils.formatTimeDiff(minReduce.getLong(Keys.FINISH_TIME),
-    minReduce.getLong(Keys.SHUFFLE_FINISHED) ) %></h3>
+<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=minReduce.getAttemptId().getTaskID()%>">
+<%=minReduce.getAttemptId().getTaskID() %></a> : 
+<%=StringUtils.formatTimeDiff(minReduce.getFinishTime(),
+    minReduce.getShuffleFinishTime() ) %></h3>
 
 <h3>Average time taken by Reduce tasks: 
-<%=StringUtils.formatTimeDiff(avgReduceTime, 0) %></h3>
+<%=StringUtils.formatTimeDiff(avg.getAvgReduceTime(), 0) %></h3>
 <h3>Worse performing reduce tasks</h3>
 <table border="2" cellpadding="5" cellspacing="2">
 <tr><td>Task Id</td><td>Time taken</td></tr>
@@ -244,11 +222,11 @@
   for (int i=0;i<showTasks && i<reduceTasks.length; i++) {
 %>
     <tr>
-    <td><a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=reduceTasks[i].get(Keys.TASKID)%>">
-        <%=reduceTasks[i].get(Keys.TASKID) %></a></td>
+    <td><a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=reduceTasks[i].getAttemptId().getTaskID()%>">
+        <%=reduceTasks[i].getAttemptId().getTaskID() %></a></td>
     <td><%=StringUtils.formatTimeDiff(
-             reduceTasks[i].getLong(Keys.FINISH_TIME), 
-             reduceTasks[i].getLong(Keys.SHUFFLE_FINISHED)) %></td>
+             reduceTasks[i].getFinishTime(),
+             reduceTasks[i].getShuffleFinishTime()) %></td>
     </tr>
 <%
   }
@@ -256,15 +234,15 @@
 </table>
 <%  
   Arrays.sort(reduceTasks, cFinishMapRed);
-  JobHistory.Task lastReduce = reduceTasks[0] ;
+  JobHistoryParser.TaskAttemptInfo lastReduce = reduceTasks[0] ;
 %>
 
 <h3>The last Reduce task 
-<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>
-&taskid=<%=lastReduce.get(Keys.TASKID)%>"><%=lastReduce.get(Keys.TASKID)%>
+<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>
+&taskid=<%=lastReduce.getAttemptId().getTaskID()%>"><%=lastReduce.getAttemptId().getTaskID()%>
 </a> finished at (relative to the Job launch time): 
 <%=StringUtils.getFormattedTimeWithDiff(dateFormat,
-                              lastReduce.getLong(Keys.FINISH_TIME), 
-                              job.getLong(Keys.LAUNCH_TIME) ) %></h3>
+                              lastReduce.getFinishTime(),
+                              job.getLaunchTime() ) %></h3>
 </center>
 </body></html>

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp Thu Sep 17 05:04:21 2009
@@ -24,6 +24,7 @@
   import="java.io.*"
   import="java.net.URL"
   import="org.apache.hadoop.mapred.*"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
   import="org.apache.hadoop.util.*"
 %>
 <%!	private static final long serialVersionUID = 1L;
@@ -47,7 +48,7 @@
 <h2>Job Configuration: JobId - <%= jobId %></h2><br>
 
 <%
-  String jobFilePath = JobTracker.getLocalJobFilePath(JobID.forName(jobId));
+  String jobFilePath = tracker.getLocalJobFilePath(JobID.forName(jobId));
   FileInputStream jobFile = null;
   try {
     jobFile = new FileInputStream(jobFilePath);

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobconf_history.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobconf_history.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobconf_history.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobconf_history.jsp Thu Sep 17 05:04:21 2009
@@ -26,6 +26,7 @@
   import="org.apache.hadoop.mapred.*"
   import="org.apache.hadoop.fs.*"
   import="org.apache.hadoop.util.*"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
 %>
 
 <%!	private static final long serialVersionUID = 1L;

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobdetailshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobdetailshistory.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobdetailshistory.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobdetailshistory.jsp Thu Sep 17 05:04:21 2009
@@ -23,132 +23,43 @@
   import="java.io.*"
   import="java.util.*"
   import="org.apache.hadoop.fs.*"
+  import="org.apache.hadoop.mapreduce.TaskAttemptID"
+  import="org.apache.hadoop.mapreduce.TaskID"
   import="org.apache.hadoop.mapred.*"
   import="org.apache.hadoop.util.*"
   import="java.text.SimpleDateFormat"
-  import="org.apache.hadoop.mapred.JobHistory.*"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
 %>
-<%!	private static final long serialVersionUID = 1L;
+<%!private static final long serialVersionUID = 1L;
 %>
 
 <%! static SimpleDateFormat dateFormat = new SimpleDateFormat("d-MMM-yyyy HH:mm:ss") ; %>
 <%
     String jobid = request.getParameter("jobid");
     String logFile = request.getParameter("logFile");
-	String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
-	
+
     Path jobFile = new Path(logFile);
     String[] jobDetails = jobFile.getName().split("_");
-    String jobUniqueString = jobDetails[0] + "_" +jobDetails[1] + "_" + jobid ;
-	
+    String jobUniqueString = jobid;
+
     FileSystem fs = (FileSystem) application.getAttribute("fileSys");
-    JobInfo job = JSPUtil.getJobInfo(request, fs);
+    JobHistoryParser.JobInfo job = JSPUtil.getJobInfo(request, fs);
 %>
 <html><body>
 <h2>Hadoop Job <%=jobid %> on <a href="jobhistory.jsp">History Viewer</a></h2>
 
-<b>User: </b> <%=job.get(Keys.USER) %><br/> 
-<b>JobName: </b> <%=job.get(Keys.JOBNAME) %><br/> 
+<b>User: </b> <%=job.getUsername() %><br/> 
+<b>JobName: </b> <%=job.getJobname() %><br/> 
 <b>JobConf: </b> <a href="jobconf_history.jsp?jobid=<%=jobid%>&jobLogDir=<%=new Path(logFile).getParent().toString()%>&jobUniqueString=<%=jobUniqueString%>"> 
-                 <%=job.get(Keys.JOBCONF) %></a><br/> 
-<b>Submitted At: </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.SUBMIT_TIME), 0 )  %><br/> 
-<b>Launched At: </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.LAUNCH_TIME), job.getLong(Keys.SUBMIT_TIME)) %><br/>
-<b>Finished At: </b>  <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.FINISH_TIME), job.getLong(Keys.LAUNCH_TIME)) %><br/>
-<b>Status: </b> <%= ((job.get(Keys.JOB_STATUS) == "")?"Incomplete" :job.get(Keys.JOB_STATUS)) %><br/> 
+                 <%=job.getJobConfPath() %></a><br/> 
+<b>Submitted At: </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getSubmitTime(), 0 )  %><br/> 
+<b>Launched At: </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLaunchTime(), job.getSubmitTime()) %><br/>
+<b>Finished At: </b>  <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getFinishTime(), job.getLaunchTime()) %><br/>
+<b>Status: </b> <%= ((job.getJobStatus()) == null ? "Incomplete" :job.getJobStatus()) %><br/> 
 <%
-    Map<String, JobHistory.Task> tasks = job.getAllTasks();
-    int totalMaps = 0 ; 
-    int totalReduces = 0;
-    int totalCleanups = 0; 
-    int totalSetups = 0; 
-    int numFailedMaps = 0; 
-    int numKilledMaps = 0;
-    int numFailedReduces = 0 ; 
-    int numKilledReduces = 0;
-    int numFinishedCleanups = 0;
-    int numFailedCleanups = 0;
-    int numKilledCleanups = 0;
-    int numFinishedSetups = 0;
-    int numFailedSetups = 0;
-    int numKilledSetups = 0;
-	
-    long mapStarted = 0 ; 
-    long mapFinished = 0 ; 
-    long reduceStarted = 0 ; 
-    long reduceFinished = 0;
-    long cleanupStarted = 0;
-    long cleanupFinished = 0; 
-    long setupStarted = 0;
-    long setupFinished = 0; 
-        
-    Map <String,String> allHosts = new TreeMap<String,String>();
-    for (JobHistory.Task task : tasks.values()) {
-      Map<String, TaskAttempt> attempts = task.getTaskAttempts();
-      allHosts.put(task.get(Keys.HOSTNAME), "");
-      for (TaskAttempt attempt : attempts.values()) {
-        long startTime = attempt.getLong(Keys.START_TIME) ; 
-        long finishTime = attempt.getLong(Keys.FINISH_TIME) ; 
-        if (Values.MAP.name().equals(task.get(Keys.TASK_TYPE))){
-          if (mapStarted==0 || mapStarted > startTime ) {
-            mapStarted = startTime; 
-          }
-          if (mapFinished < finishTime ) {
-            mapFinished = finishTime ; 
-          }
-          totalMaps++; 
-          if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numFailedMaps++; 
-          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numKilledMaps++;
-          }
-        } else if (Values.REDUCE.name().equals(task.get(Keys.TASK_TYPE))) {
-          if (reduceStarted==0||reduceStarted > startTime) {
-            reduceStarted = startTime ; 
-          }
-          if (reduceFinished < finishTime) {
-            reduceFinished = finishTime; 
-          }
-          totalReduces++; 
-          if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numFailedReduces++;
-          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numKilledReduces++;
-          }
-        } else if (Values.CLEANUP.name().equals(task.get(Keys.TASK_TYPE))) {
-          if (cleanupStarted==0||cleanupStarted > startTime) {
-            cleanupStarted = startTime ; 
-          }
-          if (cleanupFinished < finishTime) {
-            cleanupFinished = finishTime; 
-          }
-          totalCleanups++; 
-          if (Values.SUCCESS.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numFinishedCleanups++;
-          } else if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numFailedCleanups++;
-          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numKilledCleanups++;
-          } 
-        } else if (Values.SETUP.name().equals(task.get(Keys.TASK_TYPE))) {
-          if (setupStarted==0||setupStarted > startTime) {
-            setupStarted = startTime ; 
-          }
-          if (setupFinished < finishTime) {
-            setupFinished = finishTime; 
-          }
-          totalSetups++; 
-          if (Values.SUCCESS.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numFinishedSetups++;
-          } else if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numFailedSetups++;
-          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
-            numKilledSetups++;
-          }
-        }
-      }
-    }
+    HistoryViewer.SummarizedJob sj = new HistoryViewer.SummarizedJob(job);
 %>
-<b><a href="analysejobhistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>">Analyse This Job</a></b> 
+<b><a href="analysejobhistory.jsp?jobid=<%=jobid %>&logFile=<logFile%>">Analyse This Job</a></b> 
 <hr/>
 <center>
 <table border="2" cellpadding="5" cellspacing="2">
@@ -157,82 +68,88 @@
 </tr>
 <tr>
 <td>Setup</td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=all">
-        <%=totalSetups%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=<%=Values.SUCCESS %>">
-        <%=numFinishedSetups%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=<%=Values.FAILED %>">
-        <%=numFailedSetups%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=<%=Values.KILLED %>">
-        <%=numKilledSetups%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, setupStarted, 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, setupFinished, setupStarted) %></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_SETUP&status=all">
+        <%=sj.getTotalSetups()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_SETUP&status=SUCCEEDED">
+        <%=sj.getNumFinishedSetups()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_SETUP&status=FAILED">
+        <%=sj.getNumFailedSetups()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_SETUP&status=KILLED">
+        <%=sj.getNumKilledSetups()%></a></td>  
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupStarted(), 0) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupFinished(), sj.getSetupStarted()) %></td>
 </tr>
 <tr>
 <td>Map</td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=all">
-        <%=totalMaps %></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=<%=Values.SUCCESS %>">
-        <%=job.getInt(Keys.FINISHED_MAPS) %></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=<%=Values.FAILED %>">
-        <%=numFailedMaps %></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=<%=Values.KILLED %>">
-        <%=numKilledMaps %></a></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, mapStarted, 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, mapFinished, mapStarted) %></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=MAP&status=all">
+        <%=sj.getTotalMaps()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=MAP&status=SUCCEEDED">
+        <%=job.getFinishedMaps() %></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=MAP&status=FAILED">
+        <%=sj.getNumFailedMaps()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=MAP&status=KILLED">
+        <%=sj.getNumKilledMaps()%></a></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapStarted(), 0) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapFinished(), sj.getMapStarted()) %></td>
 </tr>
 <tr>
 <td>Reduce</td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=all">
-        <%=totalReduces%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=<%=Values.SUCCESS %>">
-        <%=job.getInt(Keys.FINISHED_REDUCES)%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=<%=Values.FAILED %>">
-        <%=numFailedReduces%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=<%=Values.KILLED %>">
-        <%=numKilledReduces%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, reduceStarted, 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, reduceFinished, reduceStarted) %></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=REDUCE&status=all">
+        <%=sj.getTotalReduces()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=REDUCE&status=SUCCEEDED">
+        <%=job.getFinishedReduces()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=REDUCE&status=FAILED">
+        <%=sj.getNumFailedReduces()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=REDUCE&status=KILLED">
+        <%=sj.getNumKilledReduces()%></a></td>  
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceStarted(), 0) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceFinished(), sj.getReduceStarted()) %></td>
 </tr>
 <tr>
 <td>Cleanup</td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=all">
-        <%=totalCleanups%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=<%=Values.SUCCESS %>">
-        <%=numFinishedCleanups%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=<%=Values.FAILED %>">
-        <%=numFailedCleanups%></a></td>
-    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=<%=Values.KILLED %>">
-        <%=numKilledCleanups%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, cleanupStarted, 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, cleanupFinished, cleanupStarted) %></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_CLEANUP&status=all">
+        <%=sj.getTotalCleanups()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_CLEANUP&status=SUCCEEDED">
+        <%=sj.getNumFinishedCleanups()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_CLEANUP&status=FAILED">
+        <%=sj.getNumFailedCleanups()%></a></td>
+    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=logFile%>&taskType=JOB_CLEANUP&status=KILLED>">
+        <%=sj.getNumKilledCleanups()%></a></td>  
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupStarted(), 0) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupFinished(), sj.getCleanupStarted()) %></td>
 </tr>
 </table>
 
 <br/>
  <%
-    DefaultJobHistoryParser.FailedOnNodesFilter filter = 
-                 new DefaultJobHistoryParser.FailedOnNodesFilter();
-    JobHistory.parseHistoryFromFS(logFile, filter, fs); 
-    Map<String, Set<String>> badNodes = filter.getValues(); 
+    HistoryViewer.FilteredJob filter = new HistoryViewer.FilteredJob(job,TaskStatus.State.FAILED.toString()); 
+    Map<String, Set<TaskID>> badNodes = filter.getFilteredMap(); 
     if (badNodes.size() > 0) {
  %>
 <h3>Failed tasks attempts by nodes </h3>
 <table border="1">
 <tr><td>Hostname</td><td>Failed Tasks</td></tr>
  <%	  
-      for (Map.Entry<String, Set<String>> entry : badNodes.entrySet()) {
+      for (Map.Entry<String, Set<TaskID>> entry : badNodes.entrySet()) {
         String node = entry.getKey();
-        Set<String> failedTasks = entry.getValue();
+        Set<TaskID> failedTasks = entry.getValue();
 %>
         <tr>
         <td><%=node %></td>
         <td>
 <%
-        for (String t : failedTasks) {
+          boolean firstId = true;
+          for (TaskID tid : failedTasks) {
+             if (firstId) {
+              firstId = false;
 %>
-          <a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=t %>"><%=t %></a>,&nbsp;
+            <a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=tid %>"><%=tid %></a>
 <%		  
+          } else {
+%>	
+            ,&nbsp<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=tid %>"><%=tid %></a>
+<%		  
+          }
         }
 %>	
         </td>
@@ -244,28 +161,34 @@
 </table>
 <br/>
  <%
-    DefaultJobHistoryParser.KilledOnNodesFilter killedFilter =
-                 new DefaultJobHistoryParser.KilledOnNodesFilter();
-    JobHistory.parseHistoryFromFS(logFile, filter, fs); 
-    badNodes = killedFilter.getValues(); 
+    filter = new HistoryViewer.FilteredJob(job, TaskStatus.State.KILLED.toString());
+    badNodes = filter.getFilteredMap(); 
     if (badNodes.size() > 0) {
  %>
 <h3>Killed tasks attempts by nodes </h3>
 <table border="1">
 <tr><td>Hostname</td><td>Killed Tasks</td></tr>
  <%	  
-      for (Map.Entry<String, Set<String>> entry : badNodes.entrySet()) {
+      for (Map.Entry<String, Set<TaskID>> entry : badNodes.entrySet()) {
         String node = entry.getKey();
-        Set<String> killedTasks = entry.getValue();
+        Set<TaskID> killedTasks = entry.getValue();
 %>
         <tr>
         <td><%=node %></td>
         <td>
 <%
-        for (String t : killedTasks) {
+        boolean firstId = true;
+        for (TaskID tid : killedTasks) {
+             if (firstId) {
+              firstId = false;
 %>
-          <a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=t %>"><%=t %></a>,&nbsp;
+            <a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=tid %>"><%=tid %></a>
 <%		  
+          } else {
+%>	
+            ,&nbsp<a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=logFile%>&taskid=<%=tid %>"><%=tid %></a>
+<%		  
+          }
         }
 %>	
         </td>

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobhistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobhistory.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobhistory.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobhistory.jsp Thu Sep 17 05:04:21 2009
@@ -27,7 +27,7 @@
   import="javax.servlet.jsp.*"
   import="java.text.SimpleDateFormat"
   import="org.apache.hadoop.mapred.*"
-  import="org.apache.hadoop.mapred.JobHistory.*"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
 %>
 
 <%!	private static final long serialVersionUID = 1L;
@@ -76,28 +76,31 @@
     final String user = (parts.length >= 1)
                         ? parts[0].toLowerCase()
                         : "";
-    final String jobname = (parts.length >= 2)
+    final String jobid = (parts.length >= 2)
                            ? parts[1].toLowerCase()
                            : "";
+
     PathFilter jobLogFileFilter = new PathFilter() {
       private boolean matchUser(String fileName) {
         // return true if 
         //  - user is not specified
         //  - user matches
-        return "".equals(user) || user.equals(fileName.split("_")[5]);
+        return "".equals(user) || user.equals(fileName.split("_")[3]);
       }
 
-      private boolean matchJobName(String fileName) {
+      private boolean matchJobId(String fileName) {
         // return true if 
-        //  - jobname is not specified
-        //  - jobname contains the keyword
-        return "".equals(jobname) || fileName.split("_")[6].toLowerCase().contains(jobname);
+        //  - jobid is not specified
+        //  - jobid matches 
+        String[] jobDetails = fileName.split("_");
+        String actualId = jobDetails[0] + "_" +jobDetails[1] + "_" + jobDetails[2] ;
+        return "".equals(jobid) || jobid.equalsIgnoreCase(actualId);
       }
 
       public boolean accept(Path path) {
-        return !((path.getName().endsWith(".xml") || 
+        return (!(path.getName().endsWith(".xml") || 
           path.getName().endsWith(JobHistory.OLD_SUFFIX)) && 
-          matchUser(path.getName()) && matchJobName(path.getName()));
+          matchUser(path.getName()) && matchJobId(path.getName()));
       }
     };
     
@@ -109,7 +112,7 @@
     }
     Path[] jobFiles = FileUtil.stat2Paths(fs.listStatus(new Path(historyLogDir),
                                           jobLogFileFilter));
-    out.println("<!--  user : " + user + ", jobname : " + jobname + "-->");
+    out.println("<!--  user : " + user + ", jobid : " + jobid + "-->");
     if (null == jobFiles || jobFiles.length == 0)  {
       out.println("No files found!"); 
       return ; 
@@ -148,10 +151,11 @@
     }
 
     // Display the search box
-    out.println("<form name=search><b> Filter (username:jobname) </b>"); // heading
+    out.println("<form name=search><b> Filter (username:jobid) </b>"); // heading
     out.println("<input type=text name=search size=\"20\" value=\"" + search + "\">"); // search box
     out.println("<input type=submit value=\"Filter!\" onClick=\"showUserHistory(document.getElementById('search').value)\"></form>");
-    out.println("<span class=\"small\">Example: 'smith' will display jobs either submitted by user 'smith'. 'smith:sort' will display jobs from user 'smith' having 'sort' keyword in the jobname.</span>"); // example
+    out.println("<span class=\"small\">Example: 'smith' will display jobs submitted by user 'smith'. </span>");
+    out.println("<span class=\"small\">Job Ids need to be prefixed with a colon(:) For example, :job_200908311030_0001 will display the job with that id. </span>"); // example 
     out.println("<hr>");
 
     //Show the status
@@ -166,8 +170,8 @@
     if (!"".equals(user)) {
       out.println(" for user <b>" + user + "</b>"); // show the user if present
     }
-    if (!"".equals(jobname)) {
-      out.println(" with jobname having the keyword <b>" + jobname + "</b> in it."); // show the jobname keyword if present
+    if (!"".equals(jobid)) {
+      out.println(" for jobid <b>" + jobid + "</b> in it."); // show the jobid keyword if present
     }
     out.print("</span></i>)");
 
@@ -194,12 +198,8 @@
         String dp1 = null;
         String dp2 = null;
         
-        try {
-          dp1 = JobHistory.JobInfo.decodeJobHistoryFileName(p1.getName());
-          dp2 = JobHistory.JobInfo.decodeJobHistoryFileName(p2.getName());
-        } catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-        }
+        dp1 = p1.getName();
+        dp2 = p2.getName();
                 
         String[] split1 = dp1.split("_");
         String[] split2 = dp2.split("_");
@@ -208,12 +208,8 @@
         int res = new Date(Long.parseLong(split1[1])).compareTo(
                              new Date(Long.parseLong(split2[1])));
         if (res == 0) {
-          res = new Date(Long.parseLong(split1[3])).compareTo(
-                           new Date(Long.parseLong(split2[3])));
-        }
-        if (res == 0) {
-          Long l1 = Long.parseLong(split1[4]);
-          res = l1.compareTo(Long.parseLong(split2[4]));
+          Long l1 = Long.parseLong(split1[2]);
+          res = l1.compareTo(Long.parseLong(split2[2]));
         }
         return res;
       }
@@ -226,25 +222,18 @@
 
     out.print("<table align=center border=2 cellpadding=\"5\" cellspacing=\"2\">");
     out.print("<tr>");
-    out.print("<td>Job tracker Host Name</td>" +
-              "<td>Job tracker Start time</td>" +
-              "<td>Job Id</td><td>Name</td><td>User</td>") ; 
+    out.print( "<td>Job Id</td><td>User</td>") ; 
     out.print("</tr>"); 
     
     Set<String> displayedJobs = new HashSet<String>();
     for (int i = start - 1; i < start + length - 1; ++i) {
       Path jobFile = jobFiles[i];
       
-      String decodedJobFileName = 
-          JobHistory.JobInfo.decodeJobHistoryFileName(jobFile.getName());
+      String[] jobDetails = jobFile.getName().split("_");
+
+      String jobId = jobDetails[0] + "_" +jobDetails[1] + "_" + jobDetails[2] ;
+      String userName = jobDetails[3];
 
-      String[] jobDetails = decodedJobFileName.split("_");
-      String trackerHostName = jobDetails[0];
-      String trackerStartTime = jobDetails[1];
-      String jobId = jobDetails[2] + "_" +jobDetails[3] + "_" + jobDetails[4] ;
-      String userName = jobDetails[5];
-      String jobName = jobDetails[6];
-      
       // Check if the job is already displayed. There can be multiple job 
       // history files for jobs that have restarted
       if (displayedJobs.contains(jobId)) {
@@ -253,14 +242,10 @@
         displayedJobs.add(jobId);
       }
       
-      // Encode the logfile name again to cancel the decoding done by the browser
-      String encodedJobFileName = 
-          JobHistory.JobInfo.encodeJobHistoryFileName(jobFile.getName());
 %>
 <center>
 <%	
-      printJob(trackerHostName, trackerStartTime, jobId,
-               jobName, userName, new Path(jobFile.getParent(), encodedJobFileName), 
+      printJob(jobId, userName, new Path(jobFile.getParent(), jobFile), 
                out) ; 
 %>
 </center> 
@@ -272,16 +257,12 @@
     printNavigation(pageno, size, maxPageNo, search, out);
 %>
 <%!
-    private void printJob(String trackerHostName, String trackerid,
-                          String jobId, String jobName,
+    private void printJob(String jobId, 
                           String user, Path logFile, JspWriter out)
     throws IOException {
       out.print("<tr>"); 
-      out.print("<td>" + trackerHostName + "</td>"); 
-      out.print("<td>" + new Date(Long.parseLong(trackerid)) + "</td>"); 
       out.print("<td>" + "<a href=\"jobdetailshistory.jsp?jobid=" + jobId + 
                 "&logFile=" + logFile.toString() + "\">" + jobId + "</a></td>"); 
-      out.print("<td>" + jobName + "</td>"); 
       out.print("<td>" + user + "</td>"); 
       out.print("</tr>");
     }

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobtaskshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobtaskshistory.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobtaskshistory.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobtaskshistory.jsp Thu Sep 17 05:04:21 2009
@@ -22,11 +22,13 @@
   import="javax.servlet.http.*"
   import="java.io.*"
   import="java.util.*"
+  import="org.apache.hadoop.mapreduce.TaskAttemptID"
+  import="org.apache.hadoop.mapreduce.TaskID"
   import="org.apache.hadoop.mapred.*"
   import="org.apache.hadoop.fs.*"
   import="org.apache.hadoop.util.*"
   import="java.text.SimpleDateFormat"
-  import="org.apache.hadoop.mapred.JobHistory.*"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
 %>
 
 <%!	
@@ -39,28 +41,27 @@
 <%	
   String jobid = request.getParameter("jobid");
   String logFile = request.getParameter("logFile");
-  String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
   String taskStatus = request.getParameter("status"); 
   String taskType = request.getParameter("taskType"); 
   
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
-  JobInfo job = JSPUtil.getJobInfo(request, fs);
-  Map<String, JobHistory.Task> tasks = job.getAllTasks(); 
+  JobHistoryParser.JobInfo job = JSPUtil.getJobInfo(request, fs);
+  Map<TaskID, JobHistoryParser.TaskInfo> tasks = job.getAllTasks(); 
 %>
 <html>
 <body>
-<h2><%=taskStatus%> <%=taskType %> task list for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=encodedLogFileName%>"><%=jobid %> </a></h2>
+<h2><%=taskStatus%> <%=taskType %> task list for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=logFile%>"><%=jobid %> </a></h2>
 <center>
 <table border="2" cellpadding="5" cellspacing="2">
 <tr><td>Task Id</td><td>Start Time</td><td>Finish Time<br/></td><td>Error</td></tr>
 <%
-  for (JobHistory.Task task : tasks.values()) {
-    if (taskType.equals(task.get(Keys.TASK_TYPE))){
-      Map <String, TaskAttempt> taskAttempts = task.getTaskAttempts();
-      for (JobHistory.TaskAttempt taskAttempt : taskAttempts.values()) {
-        if (taskStatus.equals(taskAttempt.get(Keys.TASK_STATUS)) || 
-          taskStatus.equals("all")){
-          printTask(jobid, encodedLogFileName, taskAttempt, out); 
+  for (JobHistoryParser.TaskInfo task : tasks.values()) {
+    if (taskType.equalsIgnoreCase(task.getTaskType().toString())) {
+      Map <TaskAttemptID, JobHistoryParser.TaskAttemptInfo> taskAttempts = task.getAllTaskAttempts();
+      for (JobHistoryParser.TaskAttemptInfo taskAttempt : taskAttempts.values()) {
+        if (taskStatus.equals(taskAttempt.getTaskStatus()) || 
+          taskStatus.equalsIgnoreCase("all")){
+          printTask(jobid, logFile, taskAttempt, out); 
         }
       }
     }
@@ -69,17 +70,17 @@
 </table>
 <%!
   private void printTask(String jobid, String logFile,
-    JobHistory.TaskAttempt attempt, JspWriter out) throws IOException{
+    JobHistoryParser.TaskAttemptInfo attempt, JspWriter out) throws IOException{
     out.print("<tr>"); 
     out.print("<td>" + "<a href=\"taskdetailshistory.jsp?jobid=" + jobid + 
-          "&logFile="+ logFile +"&taskid="+attempt.get(Keys.TASKID)+"\">" +
-          attempt.get(Keys.TASKID) + "</a></td>");
+          "&logFile="+ logFile +"&taskid="+attempt.getAttemptId().getTaskID().toString() +"\">" +
+          attempt.getAttemptId().getTaskID() + "</a></td>");
     out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
-          attempt.getLong(Keys.START_TIME), 0 ) + "</td>");
+          attempt.getStartTime(), 0 ) + "</td>");
     out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
-          attempt.getLong(Keys.FINISH_TIME),
-          attempt.getLong(Keys.START_TIME) ) + "</td>");
-    out.print("<td>" + attempt.get(Keys.ERROR) + "</td>");
+          attempt.getFinishTime(),
+          attempt.getStartTime() ) + "</td>");
+    out.print("<td>" + attempt.getError() + "</td>");
     out.print("</tr>"); 
   }
 %>

Modified: hadoop/mapreduce/trunk/src/webapps/job/taskdetailshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/taskdetailshistory.jsp?rev=816052&r1=816051&r2=816052&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/taskdetailshistory.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/taskdetailshistory.jsp Thu Sep 17 05:04:21 2009
@@ -26,7 +26,8 @@
   import="org.apache.hadoop.fs.*"
   import="org.apache.hadoop.util.*"
   import="java.text.SimpleDateFormat"
-  import="org.apache.hadoop.mapred.JobHistory.*"
+  import="org.apache.hadoop.mapreduce.TaskType"
+  import="org.apache.hadoop.mapreduce.jobhistory.*"
 %>
 
 <%!	private static SimpleDateFormat dateFormat = new SimpleDateFormat("d/MM HH:mm:ss") ; %>
@@ -36,21 +37,20 @@
 <%	
   String jobid = request.getParameter("jobid");
   String logFile = request.getParameter("logFile");
-  String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
   String taskid = request.getParameter("taskid"); 
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
-  JobInfo job = JSPUtil.getJobInfo(request, fs);
-  JobHistory.Task task = job.getAllTasks().get(taskid); 
-  String type = task.get(Keys.TASK_TYPE);
+  JobHistoryParser.JobInfo job = JSPUtil.getJobInfo(request, fs);
+  JobHistoryParser.TaskInfo task = job.getAllTasks().get(TaskID.forName(taskid)); 
+  TaskType type = task.getTaskType();
 %>
 <html>
 <body>
-<h2><%=taskid %> attempts for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=encodedLogFileName%>"> <%=jobid %> </a></h2>
+<h2><%=taskid %> attempts for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=logFile%>"> <%=jobid %> </a></h2>
 <center>
 <table border="2" cellpadding="5" cellspacing="2">
 <tr><td>Task Id</td><td>Start Time</td>
 <%	
-  if (Values.REDUCE.name().equals(type)) {
+  if (TaskType.REDUCE.equals(type)) {
 %>
     <td>Shuffle Finished</td><td>Sort Finished</td>
 <%
@@ -58,19 +58,19 @@
 %>
 <td>Finish Time</td><td>Host</td><td>Error</td><td>Task Logs</td></tr>
 <%
-  for (JobHistory.TaskAttempt attempt : task.getTaskAttempts().values()) {
+  for (JobHistoryParser.TaskAttemptInfo attempt : task.getAllTaskAttempts().values()) {
     printTaskAttempt(attempt, type, out);
   }
 %>
 </table>
 </center>
 <%	
-  if (Values.MAP.name().equals(type)) {
+  if (TaskType.MAP.equals(type)) {
 %>
 <h3>Input Split Locations</h3>
 <table border="2" cellpadding="5" cellspacing="2">
 <%
-    for (String split : StringUtils.split(task.get(Keys.SPLITS)))
+    for (String split : StringUtils.split(task.getSplitLocations()))
     {
       out.println("<tr><td>" + split + "</td></tr>");
     }
@@ -80,33 +80,31 @@
   }
 %>
 <%!
-  private void printTaskAttempt(JobHistory.TaskAttempt taskAttempt,
-                                String type, JspWriter out) 
+  private void printTaskAttempt(JobHistoryParser.TaskAttemptInfo taskAttempt,
+                                TaskType type, JspWriter out) 
   throws IOException {
     out.print("<tr>"); 
-    out.print("<td>" + taskAttempt.get(Keys.TASK_ATTEMPT_ID) + "</td>");
+    out.print("<td>" + taskAttempt.getAttemptId() + "</td>");
     out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat,
-              taskAttempt.getLong(Keys.START_TIME), 0 ) + "</td>"); 
-    if (Values.REDUCE.name().equals(type)) {
-      JobHistory.ReduceAttempt reduceAttempt = 
-            (JobHistory.ReduceAttempt)taskAttempt; 
+              taskAttempt.getStartTime(), 0 ) + "</td>"); 
+    if (TaskType.REDUCE.equals(type)) {
       out.print("<td>" + 
                 StringUtils.getFormattedTimeWithDiff(dateFormat, 
-                reduceAttempt.getLong(Keys.SHUFFLE_FINISHED), 
-                reduceAttempt.getLong(Keys.START_TIME)) + "</td>"); 
+                taskAttempt.getShuffleFinishTime(),
+                taskAttempt.getStartTime()) + "</td>"); 
       out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
-                reduceAttempt.getLong(Keys.SORT_FINISHED), 
-                reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)) + "</td>"); 
+                taskAttempt.getSortFinishTime(),
+                taskAttempt.getShuffleFinishTime()) + "</td>"); 
     }
     out.print("<td>"+ StringUtils.getFormattedTimeWithDiff(dateFormat,
-              taskAttempt.getLong(Keys.FINISH_TIME), 
-              taskAttempt.getLong(Keys.START_TIME) ) + "</td>"); 
-    out.print("<td>" + taskAttempt.get(Keys.HOSTNAME) + "</td>");
-    out.print("<td>" + taskAttempt.get(Keys.ERROR) + "</td>");
+              taskAttempt.getFinishTime(),
+              taskAttempt.getStartTime()) + "</td>"); 
+    out.print("<td>" + taskAttempt.getHostname() + "</td>");
+    out.print("<td>" + taskAttempt.getError() + "</td>");
 
     // Print task log urls
     out.print("<td>");	
-    String taskLogsUrl = JobHistory.getTaskLogsUrl(taskAttempt);
+    String taskLogsUrl = HistoryViewer.getTaskLogsUrl(taskAttempt);
     if (taskLogsUrl != null) {
 	    String tailFourKBUrl = taskLogsUrl + "&start=-4097";
 	    String tailEightKBUrl = taskLogsUrl + "&start=-8193";



Mime
View raw message