<% /* * 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.*" import="javax.servlet.http.*" import="java.io.*" import="java.lang.String" import="java.text.*" import="java.util.*" import="org.apache.hadoop.http.HtmlQuoting" import="org.apache.hadoop.mapred.*" import="org.apache.hadoop.mapred.JSPUtil.JobWithViewAccessCheck" import="org.apache.hadoop.util.*" import="java.text.SimpleDateFormat" %> <%! private static final long serialVersionUID = 1L; %> <% JobTracker tracker = (JobTracker) application.getAttribute("job.tracker"); String trackerName = StringUtils.simpleHostname(tracker.getJobTrackerMachine()); String attemptid = request.getParameter("attemptid"); TaskAttemptID attemptidObj = TaskAttemptID.forName(attemptid); // Obtain tipid for attemptId, if attemptId is available. TaskID tipidObj = (attemptidObj == null) ? TaskID.forName(request.getParameter("tipid")) : attemptidObj.getTaskID(); // Obtain jobid from tipid JobID jobidObj = tipidObj.getJobID(); String jobid = jobidObj.toString(); JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker, jobidObj, request, response); if (!myJob.isViewJobAllowed()) { return; // user is not authorized to view this job } JobInProgress job = myJob.getJob(); // redirect to history page if it cannot be found in memory if (job == null) { JobID jobIdObj = JobID.forName(jobid); String historyFile = tracker.getJobHistory().getHistoryFilePath(jobIdObj); if (historyFile == null) { out.println("

Job " + jobid + " not known!

"); return; } String historyUrl = "/taskstatshistory.jsp?logFile=" + historyFile + "&attemptid=" + attemptid; response.sendRedirect(response.encodeRedirectURL(historyUrl)); return; } Format decimal = new DecimalFormat(); Counters counters; if (attemptid == null) { counters = tracker.getTipCounters(tipidObj); attemptid = tipidObj.toString(); // for page title etc } else { TaskStatus taskStatus = tracker.getTaskStatus(attemptidObj); counters = taskStatus.getCounters(); } %> Counters for <%=attemptid%>

Counters for <%=attemptid%>


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

No counter information found for this task

<% } else { %> <% for (String groupName : counters.getGroupNames()) { Counters.Group group = counters.getGroup(groupName); String displayGroupName = group.getDisplayName(); %> <% for (Counters.Counter counter : group) { 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 JobTracker
<% out.println(ServletUtil.htmlFooter()); %>