[120] | 1 | package org.apache.hadoop.mapred; |
---|
| 2 | |
---|
| 3 | import javax.servlet.*; |
---|
| 4 | import javax.servlet.http.*; |
---|
| 5 | import javax.servlet.jsp.*; |
---|
| 6 | import javax.servlet.*; |
---|
| 7 | import javax.servlet.http.*; |
---|
| 8 | import java.io.*; |
---|
| 9 | import java.lang.String; |
---|
| 10 | import java.text.*; |
---|
| 11 | import java.util.*; |
---|
| 12 | import org.apache.hadoop.mapred.*; |
---|
| 13 | import org.apache.hadoop.util.*; |
---|
| 14 | import java.text.SimpleDateFormat; |
---|
| 15 | |
---|
| 16 | public final class taskstats_jsp extends org.apache.jasper.runtime.HttpJspBase |
---|
| 17 | implements org.apache.jasper.runtime.JspSourceDependent { |
---|
| 18 | |
---|
| 19 | private static java.util.List _jspx_dependants; |
---|
| 20 | |
---|
| 21 | public Object getDependants() { |
---|
| 22 | return _jspx_dependants; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | public void _jspService(HttpServletRequest request, HttpServletResponse response) |
---|
| 26 | throws java.io.IOException, ServletException { |
---|
| 27 | |
---|
| 28 | JspFactory _jspxFactory = null; |
---|
| 29 | PageContext pageContext = null; |
---|
| 30 | HttpSession session = null; |
---|
| 31 | ServletContext application = null; |
---|
| 32 | ServletConfig config = null; |
---|
| 33 | JspWriter out = null; |
---|
| 34 | Object page = this; |
---|
| 35 | JspWriter _jspx_out = null; |
---|
| 36 | PageContext _jspx_page_context = null; |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | try { |
---|
| 40 | _jspxFactory = JspFactory.getDefaultFactory(); |
---|
| 41 | response.setContentType("text/html; charset=UTF-8"); |
---|
| 42 | pageContext = _jspxFactory.getPageContext(this, request, response, |
---|
| 43 | null, true, 8192, true); |
---|
| 44 | _jspx_page_context = pageContext; |
---|
| 45 | application = pageContext.getServletContext(); |
---|
| 46 | config = pageContext.getServletConfig(); |
---|
| 47 | session = pageContext.getSession(); |
---|
| 48 | out = pageContext.getOut(); |
---|
| 49 | _jspx_out = out; |
---|
| 50 | |
---|
| 51 | out.write('\n'); |
---|
| 52 | |
---|
| 53 | JobTracker tracker = (JobTracker) application.getAttribute("job.tracker"); |
---|
| 54 | String trackerName = |
---|
| 55 | StringUtils.simpleHostname(tracker.getJobTrackerMachine()); |
---|
| 56 | String jobid = request.getParameter("jobid"); |
---|
| 57 | String tipid = request.getParameter("tipid"); |
---|
| 58 | String taskid = request.getParameter("taskid"); |
---|
| 59 | JobID jobidObj = JobID.forName(jobid); |
---|
| 60 | TaskID tipidObj = TaskID.forName(tipid); |
---|
| 61 | TaskAttemptID taskidObj = TaskAttemptID.forName(taskid); |
---|
| 62 | |
---|
| 63 | JobInProgress job = (JobInProgress) tracker.getJob(jobidObj); |
---|
| 64 | |
---|
| 65 | Format decimal = new DecimalFormat(); |
---|
| 66 | Counters counters; |
---|
| 67 | if (taskid == null) { |
---|
| 68 | counters = tracker.getTipCounters(tipidObj); |
---|
| 69 | taskid = tipid; // for page title etc |
---|
| 70 | } |
---|
| 71 | else { |
---|
| 72 | TaskStatus taskStatus = tracker.getTaskStatus(taskidObj); |
---|
| 73 | counters = taskStatus.getCounters(); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | out.write("\n\n<html>\n <head>\n <title>Counters for "); |
---|
| 77 | out.print(taskid); |
---|
| 78 | out.write("</title>\n </head>\n<body>\n<h1>Counters for "); |
---|
| 79 | out.print(taskid); |
---|
| 80 | out.write("</h1>\n\n<hr>\n\n"); |
---|
| 81 | |
---|
| 82 | if ( counters == null ) { |
---|
| 83 | |
---|
| 84 | out.write("\n <h3>No counter information found for this task</h3>\n"); |
---|
| 85 | |
---|
| 86 | } else { |
---|
| 87 | |
---|
| 88 | out.write("\n <table>\n"); |
---|
| 89 | |
---|
| 90 | for (String groupName : counters.getGroupNames()) { |
---|
| 91 | Counters.Group group = counters.getGroup(groupName); |
---|
| 92 | String displayGroupName = group.getDisplayName(); |
---|
| 93 | |
---|
| 94 | out.write("\n <tr>\n <td colspan=\"3\"><br/><b>"); |
---|
| 95 | out.print(displayGroupName); |
---|
| 96 | out.write("</b></td>\n </tr>\n"); |
---|
| 97 | |
---|
| 98 | for (Counters.Counter counter : group) { |
---|
| 99 | String displayCounterName = counter.getDisplayName(); |
---|
| 100 | long value = counter.getCounter(); |
---|
| 101 | |
---|
| 102 | out.write("\n <tr>\n <td width=\"50\"></td>\n <td>"); |
---|
| 103 | out.print(displayCounterName); |
---|
| 104 | out.write("</td>\n <td align=\"right\">"); |
---|
| 105 | out.print(decimal.format(value)); |
---|
| 106 | out.write("</td>\n </tr>\n"); |
---|
| 107 | |
---|
| 108 | } |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | out.write("\n </table>\n"); |
---|
| 112 | |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | out.write("\n\n<hr>\n<a href=\"jobdetails.jsp?jobid="); |
---|
| 116 | out.print(jobid); |
---|
| 117 | out.write("\">Go back to the job</a><br>\n<a href=\"jobtracker.jsp\">Go back to JobTracker</a><br>\n"); |
---|
| 118 | |
---|
| 119 | out.println(ServletUtil.htmlFooter()); |
---|
| 120 | |
---|
| 121 | out.write('\n'); |
---|
| 122 | } catch (Throwable t) { |
---|
| 123 | if (!(t instanceof SkipPageException)){ |
---|
| 124 | out = _jspx_out; |
---|
| 125 | if (out != null && out.getBufferSize() != 0) |
---|
| 126 | out.clearBuffer(); |
---|
| 127 | if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); |
---|
| 128 | } |
---|
| 129 | } finally { |
---|
| 130 | if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); |
---|
| 131 | } |
---|
| 132 | } |
---|
| 133 | } |
---|