source: proiecte/HadoopJUnit/hadoop-0.20.1/build/src/org/apache/hadoop/mapred/taskdetailshistory_jsp.java @ 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: 6.2 KB
Line 
1package org.apache.hadoop.mapred;
2
3import javax.servlet.*;
4import javax.servlet.http.*;
5import javax.servlet.jsp.*;
6import javax.servlet.http.*;
7import java.io.*;
8import java.util.*;
9import org.apache.hadoop.mapred.*;
10import org.apache.hadoop.util.*;
11import java.text.SimpleDateFormat;
12import org.apache.hadoop.mapred.JobHistory.*;
13
14public final class taskdetailshistory_jsp extends org.apache.jasper.runtime.HttpJspBase
15    implements org.apache.jasper.runtime.JspSourceDependent {
16
17        private static SimpleDateFormat dateFormat = new SimpleDateFormat("d/MM HH:mm:ss") ; 
18
19  private void printTaskAttempt(JobHistory.TaskAttempt taskAttempt,
20                                String type, JspWriter out) 
21  throws IOException {
22    out.print("<tr>"); 
23    out.print("<td>" + taskAttempt.get(Keys.TASK_ATTEMPT_ID) + "</td>");
24    out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat,
25              taskAttempt.getLong(Keys.START_TIME), 0 ) + "</td>"); 
26    if (Values.REDUCE.name().equals(type)) {
27      JobHistory.ReduceAttempt reduceAttempt = 
28            (JobHistory.ReduceAttempt)taskAttempt; 
29      out.print("<td>" + 
30                StringUtils.getFormattedTimeWithDiff(dateFormat, 
31                reduceAttempt.getLong(Keys.SHUFFLE_FINISHED), 
32                reduceAttempt.getLong(Keys.START_TIME)) + "</td>"); 
33      out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, 
34                reduceAttempt.getLong(Keys.SORT_FINISHED), 
35                reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)) + "</td>"); 
36    }
37    out.print("<td>"+ StringUtils.getFormattedTimeWithDiff(dateFormat,
38              taskAttempt.getLong(Keys.FINISH_TIME), 
39              taskAttempt.getLong(Keys.START_TIME) ) + "</td>"); 
40    out.print("<td>" + taskAttempt.get(Keys.HOSTNAME) + "</td>");
41    out.print("<td>" + taskAttempt.get(Keys.ERROR) + "</td>");
42
43    // Print task log urls
44    out.print("<td>"); 
45    String taskLogsUrl = JobHistory.getTaskLogsUrl(taskAttempt);
46    if (taskLogsUrl != null) {
47            String tailFourKBUrl = taskLogsUrl + "&start=-4097";
48            String tailEightKBUrl = taskLogsUrl + "&start=-8193";
49            String entireLogUrl = taskLogsUrl + "&all=true";
50            out.print("<a href=\"" + tailFourKBUrl + "\">Last 4KB</a><br/>");
51            out.print("<a href=\"" + tailEightKBUrl + "\">Last 8KB</a><br/>");
52            out.print("<a href=\"" + entireLogUrl + "\">All</a><br/>");
53    } else {
54        out.print("n/a");
55    }
56    out.print("</td>");
57    out.print("</tr>"); 
58  }
59
60  private static java.util.List _jspx_dependants;
61
62  public Object getDependants() {
63    return _jspx_dependants;
64  }
65
66  public void _jspService(HttpServletRequest request, HttpServletResponse response)
67        throws java.io.IOException, ServletException {
68
69    JspFactory _jspxFactory = null;
70    PageContext pageContext = null;
71    HttpSession session = null;
72    ServletContext application = null;
73    ServletConfig config = null;
74    JspWriter out = null;
75    Object page = this;
76    JspWriter _jspx_out = null;
77    PageContext _jspx_page_context = null;
78
79
80    try {
81      _jspxFactory = JspFactory.getDefaultFactory();
82      response.setContentType("text/html; charset=UTF-8");
83      pageContext = _jspxFactory.getPageContext(this, request, response,
84                        null, true, 8192, true);
85      _jspx_page_context = pageContext;
86      application = pageContext.getServletContext();
87      config = pageContext.getServletConfig();
88      session = pageContext.getSession();
89      out = pageContext.getOut();
90      _jspx_out = out;
91
92      out.write('\n');
93      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "loadhistory.jsp" + (("loadhistory.jsp").indexOf('?')>0? '&': '?') + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("jobid", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf(request.getParameter("jobid") ), request.getCharacterEncoding()) + "&" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("jobTrackerId", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf(request.getParameter("jobTrackerId") ), request.getCharacterEncoding()), out, false);
94      out.write('\n');
95      out.write('\n');
96      out.write('\n');
97       
98  String jobid = request.getParameter("jobid");
99  String logFile = request.getParameter("logFile");
100  String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
101  String taskid = request.getParameter("taskid"); 
102  JobHistory.JobInfo job = (JobHistory.JobInfo)
103                              request.getSession().getAttribute("job");
104  JobHistory.Task task = job.getAllTasks().get(taskid); 
105  String type = task.get(Keys.TASK_TYPE);
106
107      out.write("\n<html>\n<body>\n<h2>");
108      out.print(taskid );
109      out.write(" attempts for <a href=\"jobdetailshistory.jsp?jobid=");
110      out.print(jobid);
111      out.write("&&logFile=");
112      out.print(encodedLogFileName);
113      out.write('"');
114      out.write('>');
115      out.write(' ');
116      out.print(jobid );
117      out.write(" </a></h2>\n<center>\n<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n<tr><td>Task Id</td><td>Start Time</td>\n");
118       
119  if (Values.REDUCE.name().equals(type)) {
120
121      out.write("\n    <td>Shuffle Finished</td><td>Sort Finished</td>\n");
122
123  }
124
125      out.write("\n<td>Finish Time</td><td>Host</td><td>Error</td><td>Task Logs</td></tr>\n");
126
127  for (JobHistory.TaskAttempt attempt : task.getTaskAttempts().values()) {
128    printTaskAttempt(attempt, type, out);
129  }
130
131      out.write("\n</table>\n</center>\n");
132       
133  if (Values.MAP.name().equals(type)) {
134
135      out.write("\n<h3>Input Split Locations</h3>\n<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n");
136
137    for (String split : StringUtils.split(task.get(Keys.SPLITS)))
138    {
139      out.println("<tr><td>" + split + "</td></tr>");
140    }
141
142      out.write("\n</table>    \n");
143
144  }
145
146      out.write('\n');
147      out.write("\n</body>\n</html>\n");
148    } catch (Throwable t) {
149      if (!(t instanceof SkipPageException)){
150        out = _jspx_out;
151        if (out != null && out.getBufferSize() != 0)
152          out.clearBuffer();
153        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
154      }
155    } finally {
156      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
157    }
158  }
159}
Note: See TracBrowser for help on using the repository browser.