source: proiecte/HadoopJUnit/hadoop-0.20.1/src/webapps/job/jobtaskshistory.jsp @ 120

Last change on this file since 120 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: 2.6 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="logFile" value="<%=request.getParameter("logFile") %>"/>
14</jsp:include>
15<%!     
16  private static SimpleDateFormat dateFormat =
17                                    new SimpleDateFormat("d/MM HH:mm:ss") ; 
18%>
19
20<%     
21  String jobid = request.getParameter("jobid");
22  String logFile = request.getParameter("logFile");
23  String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
24  String taskStatus = request.getParameter("status"); 
25  String taskType = request.getParameter("taskType"); 
26 
27  JobHistory.JobInfo job = (JobHistory.JobInfo)request.
28                            getSession().getAttribute("job");
29  Map<String, JobHistory.Task> tasks = job.getAllTasks(); 
30%>
31<html>
32<body>
33<h2><%=taskStatus%> <%=taskType %> task list for <a href="jobdetailshistory.jsp?jobid=<%=jobid%>&&logFile=<%=encodedLogFileName%>"><%=jobid %> </a></h2>
34<center>
35<table border="2" cellpadding="5" cellspacing="2">
36<tr><td>Task Id</td><td>Start Time</td><td>Finish Time<br/></td><td>Error</td></tr>
37<%
38  for (JobHistory.Task task : tasks.values()) {
39    if (taskType.equals(task.get(Keys.TASK_TYPE))){
40      Map <String, TaskAttempt> taskAttempts = task.getTaskAttempts();
41      for (JobHistory.TaskAttempt taskAttempt : taskAttempts.values()) {
42        if (taskStatus.equals(taskAttempt.get(Keys.TASK_STATUS)) || 
43          taskStatus.equals("all")){
44          printTask(jobid, encodedLogFileName, taskAttempt, out); 
45        }
46      }
47    }
48  }
49%>
50</table>
51<%!
52  private void printTask(String jobid, String logFile,
53    JobHistory.TaskAttempt attempt, JspWriter out) throws IOException{
54    out.print("<tr>"); 
55    out.print("<td>" + "<a href=\"taskdetailshistory.jsp?jobid=" + jobid + 
56          "&logFile="+ logFile +"&taskid="+attempt.get(Keys.TASKID)+"\">" +
57          attempt.get(Keys.TASKID) + "</a></td>");
58    out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
59          attempt.getLong(Keys.START_TIME), 0 ) + "</td>");
60    out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
61          attempt.getLong(Keys.FINISH_TIME),
62          attempt.getLong(Keys.START_TIME) ) + "</td>");
63    out.print("<td>" + attempt.get(Keys.ERROR) + "</td>");
64    out.print("</tr>"); 
65  }
66%>
67</center>
68</body>
69</html>
Note: See TracBrowser for help on using the repository browser.