source: proiecte/HadoopJUnit/hadoop-0.20.1/src/webapps/job/taskdetailshistory.jsp @ 176

Last change on this file since 176 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 3.8 KB
Line 
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<%     
18  String jobid = request.getParameter("jobid");
19  String logFile = request.getParameter("logFile");
20  String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
21  String taskid = request.getParameter("taskid"); 
22  JobHistory.JobInfo job = (JobHistory.JobInfo)
23                              request.getSession().getAttribute("job");
24  JobHistory.Task task = job.getAllTasks().get(taskid); 
25  String type = task.get(Keys.TASK_TYPE);
26%>
27<html>
28<body>
29<h2><%=taskid %> attempts for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=encodedLogFileName%>"> <%=jobid %> </a></h2>
30<center>
31<table border="2" cellpadding="5" cellspacing="2">
32<tr><td>Task Id</td><td>Start Time</td>
33<%     
34  if (Values.REDUCE.name().equals(type)) {
35%>
36    <td>Shuffle Finished</td><td>Sort Finished</td>
37<%
38  }
39%>
40<td>Finish Time</td><td>Host</td><td>Error</td><td>Task Logs</td></tr>
41<%
42  for (JobHistory.TaskAttempt attempt : task.getTaskAttempts().values()) {
43    printTaskAttempt(attempt, type, out);
44  }
45%>
46</table>
47</center>
48<%     
49  if (Values.MAP.name().equals(type)) {
50%>
51<h3>Input Split Locations</h3>
52<table border="2" cellpadding="5" cellspacing="2">
53<%
54    for (String split : StringUtils.split(task.get(Keys.SPLITS)))
55    {
56      out.println("<tr><td>" + split + "</td></tr>");
57    }
58%>
59</table>   
60<%
61  }
62%>
63<%!
64  private void printTaskAttempt(JobHistory.TaskAttempt taskAttempt,
65                                String type, JspWriter out) 
66  throws IOException {
67    out.print("<tr>"); 
68    out.print("<td>" + taskAttempt.get(Keys.TASK_ATTEMPT_ID) + "</td>");
69    out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat,
70              taskAttempt.getLong(Keys.START_TIME), 0 ) + "</td>"); 
71    if (Values.REDUCE.name().equals(type)) {
72      JobHistory.ReduceAttempt reduceAttempt = 
73            (JobHistory.ReduceAttempt)taskAttempt; 
74      out.print("<td>" + 
75                StringUtils.getFormattedTimeWithDiff(dateFormat, 
76                reduceAttempt.getLong(Keys.SHUFFLE_FINISHED), 
77                reduceAttempt.getLong(Keys.START_TIME)) + "</td>"); 
78      out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
79                reduceAttempt.getLong(Keys.SORT_FINISHED), 
80                reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)) + "</td>"); 
81    }
82    out.print("<td>"+ StringUtils.getFormattedTimeWithDiff(dateFormat,
83              taskAttempt.getLong(Keys.FINISH_TIME), 
84              taskAttempt.getLong(Keys.START_TIME) ) + "</td>"); 
85    out.print("<td>" + taskAttempt.get(Keys.HOSTNAME) + "</td>");
86    out.print("<td>" + taskAttempt.get(Keys.ERROR) + "</td>");
87
88    // Print task log urls
89    out.print("<td>"); 
90    String taskLogsUrl = JobHistory.getTaskLogsUrl(taskAttempt);
91    if (taskLogsUrl != null) {
92            String tailFourKBUrl = taskLogsUrl + "&start=-4097";
93            String tailEightKBUrl = taskLogsUrl + "&start=-8193";
94            String entireLogUrl = taskLogsUrl + "&all=true";
95            out.print("<a href=\"" + tailFourKBUrl + "\">Last 4KB</a><br/>");
96            out.print("<a href=\"" + tailEightKBUrl + "\">Last 8KB</a><br/>");
97            out.print("<a href=\"" + entireLogUrl + "\">All</a><br/>");
98    } else {
99        out.print("n/a");
100    }
101    out.print("</td>");
102    out.print("</tr>"); 
103  }
104%>
105</body>
106</html>
Note: See TracBrowser for help on using the repository browser.