[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.util.*; |
---|
| 10 | import org.apache.hadoop.mapred.*; |
---|
| 11 | import org.apache.hadoop.util.*; |
---|
| 12 | |
---|
| 13 | public final class jobblacklistedtrackers_jsp extends org.apache.jasper.runtime.HttpJspBase |
---|
| 14 | implements org.apache.jasper.runtime.JspSourceDependent { |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | private void printBlackListedTrackers(JspWriter out, |
---|
| 18 | JobInProgress job) throws IOException { |
---|
| 19 | Map<String, Integer> trackerErrors = job.getTaskTrackerErrors(); |
---|
| 20 | out.print("<table border=2 cellpadding=\"5\" cellspacing=\"2\">"); |
---|
| 21 | out.print("<tr><th>TaskTracker</th><th>No. of Failures</th></tr>\n"); |
---|
| 22 | int maxErrorsPerTracker = job.getJobConf().getMaxTaskFailuresPerTracker(); |
---|
| 23 | for (Map.Entry<String,Integer> e : trackerErrors.entrySet()) { |
---|
| 24 | if (e.getValue().intValue() >= maxErrorsPerTracker) { |
---|
| 25 | out.print("<tr><td>" + e.getKey() + "</td><td>" + e.getValue() + |
---|
| 26 | "</td></tr>\n"); |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | out.print("</table>\n"); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | private static java.util.List _jspx_dependants; |
---|
| 33 | |
---|
| 34 | public Object getDependants() { |
---|
| 35 | return _jspx_dependants; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | public void _jspService(HttpServletRequest request, HttpServletResponse response) |
---|
| 39 | throws java.io.IOException, ServletException { |
---|
| 40 | |
---|
| 41 | JspFactory _jspxFactory = null; |
---|
| 42 | PageContext pageContext = null; |
---|
| 43 | HttpSession session = null; |
---|
| 44 | ServletContext application = null; |
---|
| 45 | ServletConfig config = null; |
---|
| 46 | JspWriter out = null; |
---|
| 47 | Object page = this; |
---|
| 48 | JspWriter _jspx_out = null; |
---|
| 49 | PageContext _jspx_page_context = null; |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | try { |
---|
| 53 | _jspxFactory = JspFactory.getDefaultFactory(); |
---|
| 54 | response.setContentType("text/html; charset=UTF-8"); |
---|
| 55 | pageContext = _jspxFactory.getPageContext(this, request, response, |
---|
| 56 | null, true, 8192, true); |
---|
| 57 | _jspx_page_context = pageContext; |
---|
| 58 | application = pageContext.getServletContext(); |
---|
| 59 | config = pageContext.getServletConfig(); |
---|
| 60 | session = pageContext.getSession(); |
---|
| 61 | out = pageContext.getOut(); |
---|
| 62 | _jspx_out = out; |
---|
| 63 | |
---|
| 64 | out.write('\n'); |
---|
| 65 | out.write('\n'); |
---|
| 66 | |
---|
| 67 | JobTracker tracker = (JobTracker) application.getAttribute("job.tracker"); |
---|
| 68 | String trackerName = |
---|
| 69 | StringUtils.simpleHostname(tracker.getJobTrackerMachine()); |
---|
| 70 | |
---|
| 71 | out.write('\n'); |
---|
| 72 | out.write('\n'); |
---|
| 73 | out.write('\n'); |
---|
| 74 | |
---|
| 75 | String jobId = request.getParameter("jobid"); |
---|
| 76 | if (jobId == null) { |
---|
| 77 | out.println("<h2>Missing 'jobid' for fetching black-listed tasktrackers!</h2>"); |
---|
| 78 | return; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | JobInProgress job = (JobInProgress) tracker.getJob(JobID.forName(jobId)); |
---|
| 82 | if (job == null) { |
---|
| 83 | out.print("<b>Job " + jobId + " not found.</b><br>\n"); |
---|
| 84 | return; |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | out.write("\n\n<html>\n<title>Hadoop "); |
---|
| 88 | out.print(jobId); |
---|
| 89 | out.write("'s black-listed tasktrackers</title>\n<body>\n<h1>Hadoop <a href=\"jobdetails.jsp?jobid="); |
---|
| 90 | out.print(jobId); |
---|
| 91 | out.write('"'); |
---|
| 92 | out.write('>'); |
---|
| 93 | out.print(jobId); |
---|
| 94 | out.write("</a> - \nBlack-listed task-trackers</h1>\n\n"); |
---|
| 95 | |
---|
| 96 | printBlackListedTrackers(out, job); |
---|
| 97 | |
---|
| 98 | out.write("\n\n<hr>\n<a href=\"jobdetails.jsp?jobid="); |
---|
| 99 | out.print(jobId); |
---|
| 100 | out.write("\">Go back to "); |
---|
| 101 | out.print(jobId); |
---|
| 102 | out.write("</a><br>\n"); |
---|
| 103 | |
---|
| 104 | out.println(ServletUtil.htmlFooter()); |
---|
| 105 | |
---|
| 106 | out.write('\n'); |
---|
| 107 | } catch (Throwable t) { |
---|
| 108 | if (!(t instanceof SkipPageException)){ |
---|
| 109 | out = _jspx_out; |
---|
| 110 | if (out != null && out.getBufferSize() != 0) |
---|
| 111 | out.clearBuffer(); |
---|
| 112 | if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); |
---|
| 113 | } |
---|
| 114 | } finally { |
---|
| 115 | if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); |
---|
| 116 | } |
---|
| 117 | } |
---|
| 118 | } |
---|