<% /* * 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.*" import="org.apache.hadoop.mapred.JobHistory.*" %> <%! private static SimpleDateFormat dateFormat = new SimpleDateFormat("d/MM HH:mm:ss") ; private static final long serialVersionUID = 1L; %> <% String attemptid = request.getParameter("attemptid"); if(attemptid == null) { out.println("No attemptid found! Pass a 'attemptid' parameter in the request."); return; } TaskID tipid = TaskAttemptID.forName(attemptid).getTaskID(); String logFile = request.getParameter("logFile"); String encodedLogFileName = JobHistory.JobInfo.encodeJobHistoryFilePath(logFile); String jobid = JSPUtil.getJobID(new Path(encodedLogFileName).getName()); Format decimal = new DecimalFormat(); FileSystem fs = (FileSystem) application.getAttribute("fileSys"); JobConf jobConf = (JobConf) application.getAttribute("jobConf"); ACLsManager aclsManager = (ACLsManager) application.getAttribute("aclManager"); JobHistory.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request, response, jobConf, aclsManager, fs, new Path(logFile)); if (job == null) { return; } JobHistory.Task task = job.getAllTasks().get(tipid.toString()); JobHistory.TaskAttempt attempt = task.getTaskAttempts().get(attemptid); Counters counters = Counters.fromEscapedCompactString(attempt.get(Keys.COUNTERS)); %> Counters for <%=attemptid%>

Counters for <%=attemptid%>


<% if (counters == null) { %>

No counter information found for this attempt

<% } else { %> <% for (String groupName : counters.getGroupNames()) { Counters.Group group = counters.getGroup(groupName); String displayGroupName = group.getDisplayName(); %> <% Iterator ctrItr = group.iterator(); while(ctrItr.hasNext()) { Counters.Counter counter = ctrItr.next(); String displayCounterName = counter.getDisplayName(); long value = counter.getCounter(); %> <% } } %>

<%=HtmlQuoting.quoteHtmlChars(displayGroupName)%>
<%=HtmlQuoting.quoteHtmlChars(displayCounterName)%> <%=decimal.format(value)%>
<% } %>
Go back to the job
Go back to Job History Viewer
<% out.println(ServletUtil.htmlFooter()); %>