package org.apache.hadoop.mapred; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.util.*; import java.text.SimpleDateFormat; import org.apache.hadoop.mapred.JobHistory.*; public final class taskdetailshistory_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static SimpleDateFormat dateFormat = new SimpleDateFormat("d/MM HH:mm:ss") ; private void printTaskAttempt(JobHistory.TaskAttempt taskAttempt, String type, JspWriter out) throws IOException { out.print(""); out.print("" + taskAttempt.get(Keys.TASK_ATTEMPT_ID) + ""); out.print("" + StringUtils.getFormattedTimeWithDiff(dateFormat, taskAttempt.getLong(Keys.START_TIME), 0 ) + ""); if (Values.REDUCE.name().equals(type)) { JobHistory.ReduceAttempt reduceAttempt = (JobHistory.ReduceAttempt)taskAttempt; out.print("" + StringUtils.getFormattedTimeWithDiff(dateFormat, reduceAttempt.getLong(Keys.SHUFFLE_FINISHED), reduceAttempt.getLong(Keys.START_TIME)) + ""); out.print("" + StringUtils.getFormattedTimeWithDiff(dateFormat, reduceAttempt.getLong(Keys.SORT_FINISHED), reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)) + ""); } out.print(""+ StringUtils.getFormattedTimeWithDiff(dateFormat, taskAttempt.getLong(Keys.FINISH_TIME), taskAttempt.getLong(Keys.START_TIME) ) + ""); out.print("" + taskAttempt.get(Keys.HOSTNAME) + ""); out.print("" + taskAttempt.get(Keys.ERROR) + ""); // Print task log urls out.print(""); String taskLogsUrl = JobHistory.getTaskLogsUrl(taskAttempt); if (taskLogsUrl != null) { String tailFourKBUrl = taskLogsUrl + "&start=-4097"; String tailEightKBUrl = taskLogsUrl + "&start=-8193"; String entireLogUrl = taskLogsUrl + "&all=true"; out.print("Last 4KB
"); out.print("Last 8KB
"); out.print("All
"); } else { out.print("n/a"); } out.print(""); out.print(""); } private static java.util.List _jspx_dependants; public Object getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write('\n'); 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); out.write('\n'); out.write('\n'); out.write('\n'); String jobid = request.getParameter("jobid"); String logFile = request.getParameter("logFile"); String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile); String taskid = request.getParameter("taskid"); JobHistory.JobInfo job = (JobHistory.JobInfo) request.getSession().getAttribute("job"); JobHistory.Task task = job.getAllTasks().get(taskid); String type = task.get(Keys.TASK_TYPE); out.write("\n\n\n

"); out.print(taskid ); out.write(" attempts for '); out.write(' '); out.print(jobid ); out.write("

\n
\n\n\n"); if (Values.REDUCE.name().equals(type)) { out.write("\n \n"); } out.write("\n\n"); for (JobHistory.TaskAttempt attempt : task.getTaskAttempts().values()) { printTaskAttempt(attempt, type, out); } out.write("\n
Task IdStart TimeShuffle FinishedSort FinishedFinish TimeHostErrorTask Logs
\n
\n"); if (Values.MAP.name().equals(type)) { out.write("\n

Input Split Locations

\n\n"); for (String split : StringUtils.split(task.get(Keys.SPLITS))) { out.println(""); } out.write("\n
" + split + "
\n"); } out.write('\n'); out.write("\n\n\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); } } }