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 jobtaskshistory_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 printTask(String jobid, String logFile, JobHistory.TaskAttempt attempt, JspWriter out) throws IOException{ out.print(""); out.print("" + "" + attempt.get(Keys.TASKID) + ""); out.print("" + StringUtils.getFormattedTimeWithDiff(dateFormat, attempt.getLong(Keys.START_TIME), 0 ) + ""); out.print("" + StringUtils.getFormattedTimeWithDiff(dateFormat, attempt.getLong(Keys.FINISH_TIME), attempt.getLong(Keys.START_TIME) ) + ""); out.print("" + attempt.get(Keys.ERROR) + ""); 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("logFile", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode(String.valueOf(request.getParameter("logFile") ), 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 taskStatus = request.getParameter("status"); String taskType = request.getParameter("taskType"); JobHistory.JobInfo job = (JobHistory.JobInfo)request. getSession().getAttribute("job"); Map tasks = job.getAllTasks(); out.write("\n\n\n

"); out.print(taskStatus); out.write(' '); out.print(taskType ); out.write(" task list for '); out.print(jobid ); out.write("

\n
\n\n\n"); for (JobHistory.Task task : tasks.values()) { if (taskType.equals(task.get(Keys.TASK_TYPE))){ Map taskAttempts = task.getTaskAttempts(); for (JobHistory.TaskAttempt taskAttempt : taskAttempts.values()) { if (taskStatus.equals(taskAttempt.get(Keys.TASK_STATUS)) || taskStatus.equals("all")){ printTask(jobid, encodedLogFileName, taskAttempt, out); } } } } out.write("\n
Task IdStart TimeFinish Time
Error
\n"); out.write("\n
\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); } } }