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("<tr>");
out.print("<td>" + "<a href=\"taskdetailshistory.jsp?jobid=" + jobid +
"&logFile="+ logFile +"&taskid="+attempt.get(Keys.TASKID)+"\">" +
attempt.get(Keys.TASKID) + "</a></td>");
out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat,
attempt.getLong(Keys.START_TIME), 0 ) + "</td>");
out.print("<td>" + StringUtils.getFormattedTimeWithDiff(dateFormat,
attempt.getLong(Keys.FINISH_TIME),
attempt.getLong(Keys.START_TIME) ) + "</td>");
out.print("<td>" + attempt.get(Keys.ERROR) + "</td>");
out.print("</tr>");
}
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<String, JobHistory.Task> tasks = job.getAllTasks();
out.write("\n<html>\n<body>\n<h2>");
out.print(taskStatus);
out.write(' ');
out.print(taskType );
out.write(" task list for <a href=\"jobdetailshistory.jsp?jobid=");
out.print(jobid);
out.write("&&logFile=");
out.print(encodedLogFileName);
out.write('"');
out.write('>');
out.print(jobid );
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");
for (JobHistory.Task task : tasks.values()) {
if (taskType.equals(task.get(Keys.TASK_TYPE))){
Map <String, TaskAttempt> 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</table>\n");
out.write("\n</center>\n</body>\n</html>\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);
}
}
}