1 | package org.apache.hadoop.mapred; |
---|
2 | |
---|
3 | import javax.servlet.*; |
---|
4 | import javax.servlet.http.*; |
---|
5 | import javax.servlet.jsp.*; |
---|
6 | import java.io.*; |
---|
7 | import java.util.*; |
---|
8 | import org.apache.hadoop.mapred.*; |
---|
9 | import org.apache.hadoop.fs.*; |
---|
10 | import org.apache.hadoop.util.*; |
---|
11 | import javax.servlet.jsp.*; |
---|
12 | import java.text.SimpleDateFormat; |
---|
13 | import org.apache.hadoop.mapred.JobHistory.*; |
---|
14 | |
---|
15 | public final class loadhistory_jsp extends org.apache.jasper.runtime.HttpJspBase |
---|
16 | implements org.apache.jasper.runtime.JspSourceDependent { |
---|
17 | |
---|
18 | private static java.util.List _jspx_dependants; |
---|
19 | |
---|
20 | public Object getDependants() { |
---|
21 | return _jspx_dependants; |
---|
22 | } |
---|
23 | |
---|
24 | public void _jspService(HttpServletRequest request, HttpServletResponse response) |
---|
25 | throws java.io.IOException, ServletException { |
---|
26 | |
---|
27 | JspFactory _jspxFactory = null; |
---|
28 | PageContext pageContext = null; |
---|
29 | HttpSession session = null; |
---|
30 | ServletContext application = null; |
---|
31 | ServletConfig config = null; |
---|
32 | JspWriter out = null; |
---|
33 | Object page = this; |
---|
34 | JspWriter _jspx_out = null; |
---|
35 | PageContext _jspx_page_context = null; |
---|
36 | |
---|
37 | |
---|
38 | try { |
---|
39 | _jspxFactory = JspFactory.getDefaultFactory(); |
---|
40 | response.setContentType("text/html; charset=UTF-8"); |
---|
41 | pageContext = _jspxFactory.getPageContext(this, request, response, |
---|
42 | null, true, 8192, true); |
---|
43 | _jspx_page_context = pageContext; |
---|
44 | application = pageContext.getServletContext(); |
---|
45 | config = pageContext.getServletConfig(); |
---|
46 | session = pageContext.getSession(); |
---|
47 | out = pageContext.getOut(); |
---|
48 | _jspx_out = out; |
---|
49 | |
---|
50 | out.write('\n'); |
---|
51 | |
---|
52 | PathFilter jobLogFileFilter = new PathFilter() { |
---|
53 | public boolean accept(Path path) { |
---|
54 | return !(path.getName().endsWith(".xml")); |
---|
55 | } |
---|
56 | }; |
---|
57 | |
---|
58 | FileSystem fs = (FileSystem) application.getAttribute("fileSys"); |
---|
59 | String jobId = (String)request.getParameter("jobid"); |
---|
60 | JobHistory.JobInfo job = (JobHistory.JobInfo) |
---|
61 | request.getSession().getAttribute("job"); |
---|
62 | // if session attribute of JobInfo exists and is of different job's, |
---|
63 | // then remove the attribute |
---|
64 | // if the job has not yet finished, remove the attribute sothat it |
---|
65 | // gets refreshed. |
---|
66 | boolean isJobComplete = false; |
---|
67 | if (null != job) { |
---|
68 | String jobStatus = job.get(Keys.JOB_STATUS); |
---|
69 | isJobComplete = Values.SUCCESS.name() == jobStatus |
---|
70 | || Values.FAILED.name() == jobStatus |
---|
71 | || Values.KILLED.name() == jobStatus; |
---|
72 | } |
---|
73 | if (null != job && |
---|
74 | (!jobId.equals(job.get(Keys.JOBID)) |
---|
75 | || !isJobComplete)) { |
---|
76 | // remove jobInfo from session, keep only one job in session at a time |
---|
77 | request.getSession().removeAttribute("job"); |
---|
78 | job = null ; |
---|
79 | } |
---|
80 | |
---|
81 | if (null == job) { |
---|
82 | String jobLogFile = (String)request.getParameter("logFile"); |
---|
83 | job = new JobHistory.JobInfo(jobId); |
---|
84 | DefaultJobHistoryParser.parseJobTasks(jobLogFile, job, fs) ; |
---|
85 | request.getSession().setAttribute("job", job); |
---|
86 | request.getSession().setAttribute("fs", fs); |
---|
87 | } |
---|
88 | |
---|
89 | out.write('\n'); |
---|
90 | } catch (Throwable t) { |
---|
91 | if (!(t instanceof SkipPageException)){ |
---|
92 | out = _jspx_out; |
---|
93 | if (out != null && out.getBufferSize() != 0) |
---|
94 | out.clearBuffer(); |
---|
95 | if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); |
---|
96 | } |
---|
97 | } finally { |
---|
98 | if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); |
---|
99 | } |
---|
100 | } |
---|
101 | } |
---|