<% /* * 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.http.HtmlQuoting" import="org.apache.hadoop.mapred.*" import="org.apache.hadoop.fs.*" import="org.apache.hadoop.util.*" import="java.text.SimpleDateFormat" import="org.apache.hadoop.mapreduce.jobhistory.*" %> <%! private static SimpleDateFormat dateFormat = new SimpleDateFormat("d/MM HH:mm:ss") ; %> <%! private static final long serialVersionUID = 1L; %> <% String logFile = request.getParameter("logFile"); String numTasks = request.getParameter("numTasks"); int showTasks = 10 ; if (numTasks != null) { showTasks = Integer.parseInt(numTasks); } FileSystem fs = (FileSystem) application.getAttribute("fileSys"); JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker"); JobHistoryParser.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request, response, jobTracker, fs, new Path(logFile)); if (job == null) { return; } %>

Hadoop Job <%=job.getJobId() %>

User : <%=HtmlQuoting.quoteHtmlChars(job.getUsername()) %>
JobName : <%=HtmlQuoting.quoteHtmlChars(job.getJobname()) %>
JobConf : <%=job.getJobConfPath() %>
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()) %>

<% if (!JobStatus.getJobRunState(JobStatus.SUCCEEDED).equals(job.getJobStatus())) { out.print("

No Analysis available as job did not finish

"); return; } HistoryViewer.AnalyzedJob avg = new HistoryViewer.AnalyzedJob(job); JobHistoryParser.TaskAttemptInfo [] mapTasks = avg.getMapTasks(); JobHistoryParser.TaskAttemptInfo [] reduceTasks = avg.getReduceTasks(); Comparator cMap = new Comparator() { public int compare(JobHistoryParser.TaskAttemptInfo t1, JobHistoryParser.TaskAttemptInfo t2) { long l1 = t1.getFinishTime() - t1.getStartTime(); long l2 = t2.getFinishTime() - t2.getStartTime(); return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1)); } }; Comparator cShuffle = new Comparator() { public int compare(JobHistoryParser.TaskAttemptInfo t1, JobHistoryParser.TaskAttemptInfo t2) { long l1 = t1.getShuffleFinishTime() - t1.getStartTime(); long l2 = t2.getShuffleFinishTime() - t2.getStartTime(); return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1)); } }; Comparator cFinishShuffle = new Comparator() { public int compare(JobHistoryParser.TaskAttemptInfo t1, JobHistoryParser.TaskAttemptInfo t2) { long l1 = t1.getShuffleFinishTime(); long l2 = t2.getShuffleFinishTime(); return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1)); } }; Comparator cFinishMapRed = new Comparator() { public int compare(JobHistoryParser.TaskAttemptInfo t1, JobHistoryParser.TaskAttemptInfo t2) { long l1 = t1.getFinishTime(); long l2 = t2.getFinishTime(); return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1)); } }; Comparator cReduce = new Comparator() { public int compare(JobHistoryParser.TaskAttemptInfo t1, JobHistoryParser.TaskAttemptInfo t2) { long l1 = t1.getFinishTime() - t1.getShuffleFinishTime(); long l2 = t2.getFinishTime() - t2.getShuffleFinishTime(); return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1)); } }; if (mapTasks == null || mapTasks.length <= 0) return; Arrays.sort(mapTasks, cMap); JobHistoryParser.TaskAttemptInfo minMap = mapTasks[mapTasks.length-1] ; %>

Time taken by best performing Map task <%=minMap.getAttemptId().getTaskID() %> : <%=StringUtils.formatTimeDiff(minMap.getFinishTime(), minMap.getStartTime() ) %>

Average time taken by Map tasks: <%=StringUtils.formatTimeDiff(avg.getAvgMapTime(), 0) %>

Worse performing map tasks

<% for (int i=0;i <% } %>
Task IdTime taken
<%=mapTasks[i].getAttemptId().getTaskID() %> <%=StringUtils.formatTimeDiff(mapTasks[i].getFinishTime(), mapTasks[i].getStartTime()) %>
<% Arrays.sort(mapTasks, cFinishMapRed); JobHistoryParser.TaskAttemptInfo lastMap = mapTasks[0] ; %>

The last Map task <%=lastMap.getAttemptId().getTaskID() %> finished at (relative to the Job launch time): <%=StringUtils.getFormattedTimeWithDiff(dateFormat, lastMap.getFinishTime(), job.getLaunchTime()) %>


<% if (reduceTasks.length <= 0) return; Arrays.sort(reduceTasks, cShuffle); JobHistoryParser.TaskAttemptInfo minShuffle = reduceTasks[reduceTasks.length-1] ; %>

Time taken by best performing shuffle <%=minShuffle.getAttemptId().getTaskID()%> : <%=StringUtils.formatTimeDiff(minShuffle.getShuffleFinishTime(), minShuffle.getStartTime() ) %>

Average time taken by Shuffle: <%=StringUtils.formatTimeDiff(avg.getAvgShuffleTime(), 0) %>

Worse performing Shuffle(s)

<% for (int i=0;i <% } %>
Task IdTime taken
<%=reduceTasks[i].getAttemptId().getTaskID() %> <%= StringUtils.formatTimeDiff( reduceTasks[i].getShuffleFinishTime(), reduceTasks[i].getStartTime()) %>
<% Arrays.sort(reduceTasks, cFinishShuffle); JobHistoryParser.TaskAttemptInfo lastShuffle = reduceTasks[0] ; %>

The last Shuffle <%=lastShuffle.getAttemptId().getTaskID()%> finished at (relative to the Job launch time): <%=StringUtils.getFormattedTimeWithDiff(dateFormat, lastShuffle.getShuffleFinishTime(), job.getLaunchTime() ) %>

<% Arrays.sort(reduceTasks, cReduce); JobHistoryParser.TaskAttemptInfo minReduce = reduceTasks[reduceTasks.length-1] ; %>

Time taken by best performing Reduce task : <%=minReduce.getAttemptId().getTaskID() %> : <%=StringUtils.formatTimeDiff(minReduce.getFinishTime(), minReduce.getShuffleFinishTime() ) %>

Average time taken by Reduce tasks: <%=StringUtils.formatTimeDiff(avg.getAvgReduceTime(), 0) %>

Worse performing reduce tasks

<% for (int i=0;i <% } %>
Task IdTime taken
<%=reduceTasks[i].getAttemptId().getTaskID() %> <%=StringUtils.formatTimeDiff( reduceTasks[i].getFinishTime(), reduceTasks[i].getShuffleFinishTime()) %>
<% Arrays.sort(reduceTasks, cFinishMapRed); JobHistoryParser.TaskAttemptInfo lastReduce = reduceTasks[0] ; %>

The last Reduce task <%=lastReduce.getAttemptId().getTaskID()%> finished at (relative to the Job launch time): <%=StringUtils.getFormattedTimeWithDiff(dateFormat, lastReduce.getFinishTime(), job.getLaunchTime() ) %>