[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.http.*; |
---|
| 7 | import java.io.*; |
---|
| 8 | import java.util.*; |
---|
| 9 | import org.apache.hadoop.mapred.*; |
---|
| 10 | import org.apache.hadoop.util.*; |
---|
| 11 | import java.text.SimpleDateFormat; |
---|
| 12 | import org.apache.hadoop.mapred.JobHistory.*; |
---|
| 13 | |
---|
| 14 | public final class jobtaskshistory_jsp extends org.apache.jasper.runtime.HttpJspBase |
---|
| 15 | implements org.apache.jasper.runtime.JspSourceDependent { |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | private static SimpleDateFormat dateFormat = |
---|
| 19 | new SimpleDateFormat("d/MM HH:mm:ss") ; |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | private void printTask(String jobid, String logFile, |
---|
| 23 | JobHistory.TaskAttempt attempt, JspWriter out) throws IOException{ |
---|
| 24 | out.print("<tr>"); |
---|
| 25 | out.print("<td>" + "<a href=\"taskdetailshistory.jsp?jobid=" + jobid + |
---|
| 26 | "&logFile="+ logFile +"&taskid="+attempt.get(Keys.TASKID)+"\">" + |
---|
| 27 | attempt.get(Keys.TASKID) + "</a></td>"); |
---|
| 28 | out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, |
---|
| 29 | attempt.getLong(Keys.START_TIME), 0 ) + "</td>"); |
---|
| 30 | out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat, |
---|
| 31 | attempt.getLong(Keys.FINISH_TIME), |
---|
| 32 | attempt.getLong(Keys.START_TIME) ) + "</td>"); |
---|
| 33 | out.print("<td>" + attempt.get(Keys.ERROR) + "</td>"); |
---|
| 34 | out.print("</tr>"); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | private static java.util.List _jspx_dependants; |
---|
| 38 | |
---|
| 39 | public Object getDependants() { |
---|
| 40 | return _jspx_dependants; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | public void _jspService(HttpServletRequest request, HttpServletResponse response) |
---|
| 44 | throws java.io.IOException, ServletException { |
---|
| 45 | |
---|
| 46 | JspFactory _jspxFactory = null; |
---|
| 47 | PageContext pageContext = null; |
---|
| 48 | HttpSession session = null; |
---|
| 49 | ServletContext application = null; |
---|
| 50 | ServletConfig config = null; |
---|
| 51 | JspWriter out = null; |
---|
| 52 | Object page = this; |
---|
| 53 | JspWriter _jspx_out = null; |
---|
| 54 | PageContext _jspx_page_context = null; |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | try { |
---|
| 58 | _jspxFactory = JspFactory.getDefaultFactory(); |
---|
| 59 | response.setContentType("text/html; charset=UTF-8"); |
---|
| 60 | pageContext = _jspxFactory.getPageContext(this, request, response, |
---|
| 61 | null, true, 8192, true); |
---|
| 62 | _jspx_page_context = pageContext; |
---|
| 63 | application = pageContext.getServletContext(); |
---|
| 64 | config = pageContext.getServletConfig(); |
---|
| 65 | session = pageContext.getSession(); |
---|
| 66 | out = pageContext.getOut(); |
---|
| 67 | _jspx_out = out; |
---|
| 68 | |
---|
| 69 | out.write('\n'); |
---|
| 70 | 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("logFile", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf(request.getParameter("logFile") ), request.getCharacterEncoding()), out, false); |
---|
| 71 | out.write('\n'); |
---|
| 72 | out.write('\n'); |
---|
| 73 | out.write('\n'); |
---|
| 74 | |
---|
| 75 | String jobid = request.getParameter("jobid"); |
---|
| 76 | String logFile = request.getParameter("logFile"); |
---|
| 77 | String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile); |
---|
| 78 | String taskStatus = request.getParameter("status"); |
---|
| 79 | String taskType = request.getParameter("taskType"); |
---|
| 80 | |
---|
| 81 | JobHistory.JobInfo job = (JobHistory.JobInfo)request. |
---|
| 82 | getSession().getAttribute("job"); |
---|
| 83 | Map<String, JobHistory.Task> tasks = job.getAllTasks(); |
---|
| 84 | |
---|
| 85 | out.write("\n<html>\n<body>\n<h2>"); |
---|
| 86 | out.print(taskStatus); |
---|
| 87 | out.write(' '); |
---|
| 88 | out.print(taskType ); |
---|
| 89 | out.write(" task list for <a href=\"jobdetailshistory.jsp?jobid="); |
---|
| 90 | out.print(jobid); |
---|
| 91 | out.write("&&logFile="); |
---|
| 92 | out.print(encodedLogFileName); |
---|
| 93 | out.write('"'); |
---|
| 94 | out.write('>'); |
---|
| 95 | out.print(jobid ); |
---|
| 96 | out.write(" </a></h2>\n<center>\n<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n<tr><td>Task Id</td><td>Start Time</td><td>Finish Time<br/></td><td>Error</td></tr>\n"); |
---|
| 97 | |
---|
| 98 | for (JobHistory.Task task : tasks.values()) { |
---|
| 99 | if (taskType.equals(task.get(Keys.TASK_TYPE))){ |
---|
| 100 | Map <String, TaskAttempt> taskAttempts = task.getTaskAttempts(); |
---|
| 101 | for (JobHistory.TaskAttempt taskAttempt : taskAttempts.values()) { |
---|
| 102 | if (taskStatus.equals(taskAttempt.get(Keys.TASK_STATUS)) || |
---|
| 103 | taskStatus.equals("all")){ |
---|
| 104 | printTask(jobid, encodedLogFileName, taskAttempt, out); |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | out.write("\n</table>\n"); |
---|
| 111 | out.write("\n</center>\n</body>\n</html>\n"); |
---|
| 112 | } catch (Throwable t) { |
---|
| 113 | if (!(t instanceof SkipPageException)){ |
---|
| 114 | out = _jspx_out; |
---|
| 115 | if (out != null && out.getBufferSize() != 0) |
---|
| 116 | out.clearBuffer(); |
---|
| 117 | if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); |
---|
| 118 | } |
---|
| 119 | } finally { |
---|
| 120 | if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); |
---|
| 121 | } |
---|
| 122 | } |
---|
| 123 | } |
---|