source: proiecte/HadoopJUnit/hadoop-0.20.1/src/webapps/job/jobdetailshistory.jsp @ 176

Last change on this file since 176 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 11.3 KB
Line 
1<%@ page
2  contentType="text/html; charset=UTF-8"
3  import="javax.servlet.http.*"
4  import="java.io.*"
5  import="java.util.*"
6  import="org.apache.hadoop.fs.*"
7  import="org.apache.hadoop.mapred.*"
8  import="org.apache.hadoop.util.*"
9  import="java.text.SimpleDateFormat"
10  import="org.apache.hadoop.mapred.JobHistory.*"
11%>
12<jsp:include page="loadhistory.jsp">
13  <jsp:param name="jobid" value="<%=request.getParameter("jobid") %>"/>
14  <jsp:param name="logFile" value="<%=request.getParameter("logFile") %>"/>
15</jsp:include>
16<%! static SimpleDateFormat dateFormat = new SimpleDateFormat("d-MMM-yyyy HH:mm:ss") ; %>
17<%
18    String jobid = request.getParameter("jobid");
19    String logFile = request.getParameter("logFile");
20        String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile);
21       
22    Path jobFile = new Path(logFile);
23    String[] jobDetails = jobFile.getName().split("_");
24    String jobUniqueString = jobDetails[0] + "_" +jobDetails[1] + "_" + jobid ;
25       
26    JobInfo job = (JobInfo)request.getSession().getAttribute("job");
27    FileSystem fs = (FileSystem)request.getSession().getAttribute("fs");
28%>
29<html><body>
30<h2>Hadoop Job <%=jobid %> on <a href="jobhistory.jsp">History Viewer</a></h2>
31
32<b>User: </b> <%=job.get(Keys.USER) %><br/> 
33<b>JobName: </b> <%=job.get(Keys.JOBNAME) %><br/> 
34<b>JobConf: </b> <a href="jobconf_history.jsp?jobid=<%=jobid%>&jobLogDir=<%=new Path(logFile).getParent().toString()%>&jobUniqueString=<%=jobUniqueString%>"> 
35                 <%=job.get(Keys.JOBCONF) %></a><br/> 
36<b>Submitted At: </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.SUBMIT_TIME), 0 )  %><br/> 
37<b>Launched At: </b> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.LAUNCH_TIME), job.getLong(Keys.SUBMIT_TIME)) %><br/>
38<b>Finished At: </b>  <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLong(Keys.FINISH_TIME), job.getLong(Keys.LAUNCH_TIME)) %><br/>
39<b>Status: </b> <%= ((job.get(Keys.JOB_STATUS) == "")?"Incomplete" :job.get(Keys.JOB_STATUS)) %><br/> 
40<%
41    Map<String, JobHistory.Task> tasks = job.getAllTasks();
42    int totalMaps = 0 ; 
43    int totalReduces = 0;
44    int totalCleanups = 0; 
45    int totalSetups = 0; 
46    int numFailedMaps = 0; 
47    int numKilledMaps = 0;
48    int numFailedReduces = 0 ; 
49    int numKilledReduces = 0;
50    int numFinishedCleanups = 0;
51    int numFailedCleanups = 0;
52    int numKilledCleanups = 0;
53    int numFinishedSetups = 0;
54    int numFailedSetups = 0;
55    int numKilledSetups = 0;
56       
57    long mapStarted = 0 ; 
58    long mapFinished = 0 ; 
59    long reduceStarted = 0 ; 
60    long reduceFinished = 0;
61    long cleanupStarted = 0;
62    long cleanupFinished = 0; 
63    long setupStarted = 0;
64    long setupFinished = 0; 
65       
66    Map <String,String> allHosts = new TreeMap<String,String>();
67    for (JobHistory.Task task : tasks.values()) {
68      Map<String, TaskAttempt> attempts = task.getTaskAttempts();
69      allHosts.put(task.get(Keys.HOSTNAME), "");
70      for (TaskAttempt attempt : attempts.values()) {
71        long startTime = attempt.getLong(Keys.START_TIME) ; 
72        long finishTime = attempt.getLong(Keys.FINISH_TIME) ; 
73        if (Values.MAP.name().equals(task.get(Keys.TASK_TYPE))){
74          if (mapStarted==0 || mapStarted > startTime ) {
75            mapStarted = startTime; 
76          }
77          if (mapFinished < finishTime ) {
78            mapFinished = finishTime ; 
79          }
80          totalMaps++; 
81          if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
82            numFailedMaps++; 
83          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
84            numKilledMaps++;
85          }
86        } else if (Values.REDUCE.name().equals(task.get(Keys.TASK_TYPE))) {
87          if (reduceStarted==0||reduceStarted > startTime) {
88            reduceStarted = startTime ; 
89          }
90          if (reduceFinished < finishTime) {
91            reduceFinished = finishTime; 
92          }
93          totalReduces++; 
94          if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
95            numFailedReduces++;
96          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
97            numKilledReduces++;
98          }
99        } else if (Values.CLEANUP.name().equals(task.get(Keys.TASK_TYPE))) {
100          if (cleanupStarted==0||cleanupStarted > startTime) {
101            cleanupStarted = startTime ; 
102          }
103          if (cleanupFinished < finishTime) {
104            cleanupFinished = finishTime; 
105          }
106          totalCleanups++; 
107          if (Values.SUCCESS.name().equals(attempt.get(Keys.TASK_STATUS))) {
108            numFinishedCleanups++;
109          } else if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
110            numFailedCleanups++;
111          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
112            numKilledCleanups++;
113          } 
114        } else if (Values.SETUP.name().equals(task.get(Keys.TASK_TYPE))) {
115          if (setupStarted==0||setupStarted > startTime) {
116            setupStarted = startTime ; 
117          }
118          if (setupFinished < finishTime) {
119            setupFinished = finishTime; 
120          }
121          totalSetups++; 
122          if (Values.SUCCESS.name().equals(attempt.get(Keys.TASK_STATUS))) {
123            numFinishedSetups++;
124          } else if (Values.FAILED.name().equals(attempt.get(Keys.TASK_STATUS))) {
125            numFailedSetups++;
126          } else if (Values.KILLED.name().equals(attempt.get(Keys.TASK_STATUS))) {
127            numKilledSetups++;
128          }
129        }
130      }
131    }
132%>
133<b><a href="analysejobhistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>">Analyse This Job</a></b> 
134<hr/>
135<center>
136<table border="2" cellpadding="5" cellspacing="2">
137<tr>
138<td>Kind</td><td>Total Tasks(successful+failed+killed)</td><td>Successful tasks</td><td>Failed tasks</td><td>Killed tasks</td><td>Start Time</td><td>Finish Time</td>
139</tr>
140<tr>
141<td>Setup</td>
142    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=all">
143        <%=totalSetups%></a></td>
144    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=<%=Values.SUCCESS %>">
145        <%=numFinishedSetups%></a></td>
146    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=<%=Values.FAILED %>">
147        <%=numFailedSetups%></a></td>
148    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.SETUP.name() %>&status=<%=Values.KILLED %>">
149        <%=numKilledSetups%></a></td> 
150    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, setupStarted, 0) %></td>
151    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, setupFinished, setupStarted) %></td>
152</tr>
153<tr>
154<td>Map</td>
155    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=all">
156        <%=totalMaps %></a></td>
157    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=<%=Values.SUCCESS %>">
158        <%=job.getInt(Keys.FINISHED_MAPS) %></a></td>
159    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=<%=Values.FAILED %>">
160        <%=numFailedMaps %></a></td>
161    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.MAP.name() %>&status=<%=Values.KILLED %>">
162        <%=numKilledMaps %></a></td>
163    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, mapStarted, 0) %></td>
164    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, mapFinished, mapStarted) %></td>
165</tr>
166<tr>
167<td>Reduce</td>
168    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=all">
169        <%=totalReduces%></a></td>
170    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=<%=Values.SUCCESS %>">
171        <%=job.getInt(Keys.FINISHED_REDUCES)%></a></td>
172    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=<%=Values.FAILED %>">
173        <%=numFailedReduces%></a></td>
174    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.REDUCE.name() %>&status=<%=Values.KILLED %>">
175        <%=numKilledReduces%></a></td> 
176    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, reduceStarted, 0) %></td>
177    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, reduceFinished, reduceStarted) %></td>
178</tr>
179<tr>
180<td>Cleanup</td>
181    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=all">
182        <%=totalCleanups%></a></td>
183    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=<%=Values.SUCCESS %>">
184        <%=numFinishedCleanups%></a></td>
185    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=<%=Values.FAILED %>">
186        <%=numFailedCleanups%></a></td>
187    <td><a href="jobtaskshistory.jsp?jobid=<%=jobid %>&logFile=<%=encodedLogFileName%>&taskType=<%=Values.CLEANUP.name() %>&status=<%=Values.KILLED %>">
188        <%=numKilledCleanups%></a></td> 
189    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, cleanupStarted, 0) %></td>
190    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, cleanupFinished, cleanupStarted) %></td>
191</tr>
192</table>
193
194<br/>
195 <%
196    DefaultJobHistoryParser.FailedOnNodesFilter filter = 
197                 new DefaultJobHistoryParser.FailedOnNodesFilter();
198    JobHistory.parseHistoryFromFS(logFile, filter, fs); 
199    Map<String, Set<String>> badNodes = filter.getValues(); 
200    if (badNodes.size() > 0) {
201 %>
202<h3>Failed tasks attempts by nodes </h3>
203<table border="1">
204<tr><td>Hostname</td><td>Failed Tasks</td></tr>
205 <%       
206      for (Map.Entry<String, Set<String>> entry : badNodes.entrySet()) {
207        String node = entry.getKey();
208        Set<String> failedTasks = entry.getValue();
209%>
210        <tr>
211        <td><%=node %></td>
212        <td>
213<%
214        for (String t : failedTasks) {
215%>
216          <a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=t %>"><%=t %></a>,&nbsp;
217<%               
218        }
219%>     
220        </td>
221        </tr>
222<%       
223      }
224        }
225 %>
226</table>
227<br/>
228 <%
229    DefaultJobHistoryParser.KilledOnNodesFilter killedFilter =
230                 new DefaultJobHistoryParser.KilledOnNodesFilter();
231    JobHistory.parseHistoryFromFS(logFile, filter, fs); 
232    badNodes = killedFilter.getValues(); 
233    if (badNodes.size() > 0) {
234 %>
235<h3>Killed tasks attempts by nodes </h3>
236<table border="1">
237<tr><td>Hostname</td><td>Killed Tasks</td></tr>
238 <%       
239      for (Map.Entry<String, Set<String>> entry : badNodes.entrySet()) {
240        String node = entry.getKey();
241        Set<String> killedTasks = entry.getValue();
242%>
243        <tr>
244        <td><%=node %></td>
245        <td>
246<%
247        for (String t : killedTasks) {
248%>
249          <a href="taskdetailshistory.jsp?jobid=<%=jobid%>&logFile=<%=encodedLogFileName%>&taskid=<%=t %>"><%=t %></a>,&nbsp;
250<%               
251        }
252%>     
253        </td>
254        </tr>
255<%       
256      }
257    }
258%>
259</table>
260</center>
261</body></html>
Note: See TracBrowser for help on using the repository browser.