<% /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ %> <%@ page contentType="text/html; charset=UTF-8" import="javax.servlet.http.*" import="java.io.*" import="java.util.*" import="org.apache.hadoop.fs.*" import="org.apache.hadoop.http.HtmlQuoting" import="org.apache.hadoop.mapreduce.TaskAttemptID" import="org.apache.hadoop.mapreduce.TaskID" import="org.apache.hadoop.mapreduce.Counter" import="org.apache.hadoop.mapreduce.Counters" import="org.apache.hadoop.mapreduce.CounterGroup" import="org.apache.hadoop.mapred.*" import="org.apache.hadoop.util.*" import="java.text.*" import="org.apache.hadoop.mapreduce.jobhistory.*" import="java.security.PrivilegedExceptionAction" import="org.apache.hadoop.security.AccessControlException" import="org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.JobInfo" import="org.apache.hadoop.mapreduce.JobACL" import="org.apache.hadoop.security.authorize.AccessControlList" %> <%!private static final long serialVersionUID = 1L; %> <%! static SimpleDateFormat dateFormat = new SimpleDateFormat("d-MMM-yyyy HH:mm:ss") ; %> <% String logFile = request.getParameter("logFile"); String reasonforFailure = " "; final Path jobFile = new Path(logFile); String jobid = JobHistory.getJobIDFromHistoryFilePath(jobFile).toString(); final FileSystem fs = (FileSystem) application.getAttribute("fileSys"); final JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker"); JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request, response, jobTracker, fs, jobFile); if (job == null) { return; } if (job.getJobStatus().equals("FAILED")) reasonforFailure = job.getErrorInfo(); %> Hadoop Job <%=jobid%> on History Viewer

Hadoop Job <%=jobid %> on History Viewer

User: <%=HtmlQuoting.quoteHtmlChars(job.getUsername()) %>
JobName: <%=HtmlQuoting.quoteHtmlChars(job.getJobname()) %>
JobConf: <%=job.getJobConfPath() %>
<% Map jobAcls = job.getJobACLs(); JSPUtil.printJobACLs(jobTracker, jobAcls, out); %> Submitted At: <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getSubmitTime(), 0 ) %>
Launched At: <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getLaunchTime(), job.getSubmitTime()) %>
Finished At: <%=StringUtils.getFormattedTimeWithDiff(dateFormat, job.getFinishTime(), job.getLaunchTime()) %>
Status: <%= ((job.getJobStatus()) == null ? "Incomplete" :job.getJobStatus()) %>
ReasonForFailure: <%=reasonforFailure %>
<% HistoryViewer.SummarizedJob sj = new HistoryViewer.SummarizedJob(job); %> Analyse This Job
KindTotal Tasks(successful+failed+killed)Successful tasksFailed tasksKilled tasksStart TimeFinish Time
Setup <%=sj.getTotalSetups()%> <%=sj.getNumFinishedSetups()%> <%=sj.getNumFailedSetups()%> <%=sj.getNumKilledSetups()%> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupStarted(), 0) %> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupFinished(), sj.getSetupStarted()) %>
Map <%=sj.getTotalMaps()%> <%=job.getFinishedMaps() %> <%=sj.getNumFailedMaps()%> <%=sj.getNumKilledMaps()%> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapStarted(), 0) %> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapFinished(), sj.getMapStarted()) %>
Reduce <%=sj.getTotalReduces()%> <%=job.getFinishedReduces()%> <%=sj.getNumFailedReduces()%> <%=sj.getNumKilledReduces()%> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceStarted(), 0) %> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceFinished(), sj.getReduceStarted()) %>
Cleanup <%=sj.getTotalCleanups()%> <%=sj.getNumFinishedCleanups()%> <%=sj.getNumFailedCleanups()%> <%=sj.getNumKilledCleanups()%> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupStarted(), 0) %> <%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupFinished(), sj.getCleanupStarted()) %>


<% Counters totalCounters = job.getTotalCounters(); Counters mapCounters = job.getMapCounters(); Counters reduceCounters = job.getReduceCounters(); if (totalCounters != null) { for (String groupName : totalCounters.getGroupNames()) { CounterGroup totalGroup = totalCounters.getGroup(groupName); CounterGroup mapGroup = mapCounters.getGroup(groupName); CounterGroup reduceGroup = reduceCounters.getGroup(groupName); Format decimal = new DecimalFormat(); boolean isFirst = true; Iterator ctrItr = totalGroup.iterator(); while(ctrItr.hasNext()) { Counter counter = ctrItr.next(); String name = counter.getName(); String mapValue = decimal.format(mapGroup.findCounter(name).getValue()); String reduceValue = decimal.format(reduceGroup.findCounter(name).getValue()); String totalValue = decimal.format(counter.getValue()); %> <% if (isFirst) { isFirst = false; %> <% } %> <% } } } %>

Counter Map Reduce Total
<%=HtmlQuoting.quoteHtmlChars(totalGroup.getDisplayName())%><%=HtmlQuoting.quoteHtmlChars(counter.getDisplayName())%> <%=mapValue%> <%=reduceValue%> <%=totalValue%>


<% HistoryViewer.FilteredJob filter = new HistoryViewer.FilteredJob(job,TaskStatus.State.FAILED.toString()); Map> badNodes = filter.getFilteredMap(); if (badNodes.size() > 0) { %>

Failed tasks attempts by nodes

<% for (Map.Entry> entry : badNodes.entrySet()) { String node = entry.getKey(); Set failedTasks = entry.getValue(); %> <% } } %>
HostnameFailed Tasks
<%=node %> <% boolean firstId = true; for (TaskID tid : failedTasks) { if (firstId) { firstId = false; %> <%=tid %> <% } else { %> , <%=tid %> <% } } %>

<% filter = new HistoryViewer.FilteredJob(job, TaskStatus.State.KILLED.toString()); badNodes = filter.getFilteredMap(); if (badNodes.size() > 0) { %>

Killed tasks attempts by nodes

<% for (Map.Entry> entry : badNodes.entrySet()) { String node = entry.getKey(); Set killedTasks = entry.getValue(); %> <% } } %>
HostnameKilled Tasks
<%=node %> <% boolean firstId = true; for (TaskID tid : killedTasks) { if (firstId) { firstId = false; %> <%=tid %> <% } else { %> , <%=tid %> <% } } %>