taskdetailshistory.jsp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <%@ page
  2. contentType="text/html; charset=UTF-8"
  3. import="javax.servlet.http.*"
  4. import="java.io.*"
  5. import="java.util.*"
  6. import="org.apache.hadoop.mapred.*"
  7. import="org.apache.hadoop.util.*"
  8. import="java.text.SimpleDateFormat"
  9. import="org.apache.hadoop.mapred.JobHistory.*"
  10. %>
  11. <jsp:include page="loadhistory.jsp">
  12. <jsp:param name="jobid" value="<%=request.getParameter("jobid") %>"/>
  13. <jsp:param name="jobTrackerId" value="<%=request.getParameter("jobTrackerId") %>"/>
  14. </jsp:include>
  15. <%! private static SimpleDateFormat dateFormat = new SimpleDateFormat("d/MM HH:mm:ss") ; %>
  16. <%
  17. String jobid = request.getParameter("jobid");
  18. String jobTrackerId = request.getParameter("jobTrackerId");
  19. String taskid = request.getParameter("taskid");
  20. JobHistory.JobInfo job = (JobHistory.JobInfo)request.getSession().getAttribute("job");
  21. JobHistory.Task task = job.getAllTasks().get(taskid);
  22. %>
  23. <html>
  24. <body>
  25. <h2><%=taskid %> attempts for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&jobTrackerId=<%=jobTrackerId %>"> <%=jobid %> </a></h2>
  26. <center>
  27. <table border="2" cellpadding="5" cellspacing="2">
  28. <tr><td>Task Id</td><td>Start Time</td>
  29. <%
  30. if( Values.REDUCE.name().equals(task.get(Keys.TASK_TYPE) ) ){
  31. %>
  32. <td>Shuffle Finished</td><td>Sort Finished</td>
  33. <%
  34. }
  35. %>
  36. <td>Finish Time</td><td>Host</td><td>Error</td></tr>
  37. <%
  38. for( JobHistory.TaskAttempt attempt : task.getTaskAttempts().values() ) {
  39. printTaskAttempt(attempt, task.get(Keys.TASK_TYPE), out);
  40. }
  41. %>
  42. </table>
  43. <%!
  44. private void printTaskAttempt(JobHistory.TaskAttempt taskAttempt, String type, JspWriter out) throws IOException{
  45. out.print("<tr>");
  46. out.print("<td>" + taskAttempt.get(Keys.TASK_ATTEMPT_ID) + "</td>");
  47. out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, taskAttempt.getLong(Keys.START_TIME), 0 ) + "</td>") ;
  48. if(Values.REDUCE.name().equals(type) ){
  49. JobHistory.ReduceAttempt reduceAttempt = (JobHistory.ReduceAttempt)taskAttempt ;
  50. out.print("<td>" +
  51. StringUtils.getFormattedTimeWithDiff(dateFormat,
  52. reduceAttempt.getLong(Keys.SHUFFLE_FINISHED),
  53. reduceAttempt.getLong(Keys.START_TIME)) + "</td>") ;
  54. out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat,
  55. reduceAttempt.getLong(Keys.SORT_FINISHED),
  56. reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)) + "</td>") ;
  57. }
  58. out.print("<td>"+ StringUtils.getFormattedTimeWithDiff(dateFormat, taskAttempt.getLong(Keys.FINISH_TIME),
  59. taskAttempt.getLong(Keys.START_TIME) ) + "</td>") ;
  60. out.print("<td>" + taskAttempt.get(Keys.HOSTNAME) + "</td>");
  61. out.print("<td>" + taskAttempt.get(Keys.ERROR) + "</td>");
  62. out.print("</tr>");
  63. }
  64. %>
  65. </center>
  66. </body>
  67. </html>