All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.hadoop.mapred.taskdetails_jsp Maven / Gradle / Ivy

The newest version!
package org.apache.hadoop.mapred;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.lang.String;
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;
import org.apache.hadoop.security.UserGroupInformation;
import java.security.PrivilegedExceptionAction;
import org.apache.hadoop.security.AccessControlException;

public final class taskdetails_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

static SimpleDateFormat dateFormat = new SimpleDateFormat(
      "d-MMM-yyyy HH:mm:ss");


	private static final long serialVersionUID = 1L;

private void printConfirm(JspWriter out,
      String attemptid, String action) throws IOException {
    String url = "taskdetails.jsp?attemptid=" + attemptid;
    out.print("" + "

Are you sure you want to kill/fail " + attemptid + " ?


" + "
" + "" + "" + "
" + "
"); } private static java.util.List _jspx_dependants; public Object getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; /* * 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. */ out.write('\n'); out.write('\n'); out.write('\n'); out.write('\n'); out.write('\n'); final JobTracker tracker = (JobTracker) application.getAttribute("job.tracker"); String attemptid = request.getParameter("attemptid"); final TaskAttemptID attemptidObj = TaskAttemptID.forName(attemptid); // Obtain tipid for attemptid, if attemptid is available. TaskID tipidObj = (attemptidObj == null) ? TaskID.forName(request.getParameter("tipid")) : attemptidObj.getTaskID(); if (tipidObj == null) { out.print("tipid sent is not valid.
\n"); return; } // Obtain jobid from tipid final 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) { String historyFile = tracker.getJobHistory().getHistoryFilePath(jobidObj); if (historyFile == null) { out.println("

Job " + jobid + " not known!

"); return; } String historyUrl = "/taskdetailshistory.jsp?logFile=" + historyFile + "&tipid=" + tipidObj.toString(); response.sendRedirect(response.encodeRedirectURL(historyUrl)); return; } boolean privateActions = JSPUtil.privateActionsAllowed(tracker.conf); if (privateActions) { String action = request.getParameter("action"); if (action != null) { String user = request.getRemoteUser(); UserGroupInformation ugi = null; if (user != null) { ugi = UserGroupInformation.createRemoteUser(user); } if (action.equalsIgnoreCase("confirm")) { String subAction = request.getParameter("subaction"); if (subAction == null) subAction = "fail-task"; printConfirm(out, attemptid, subAction); return; } else if (action.equalsIgnoreCase("kill-task") && request.getMethod().equalsIgnoreCase("POST")) { if (ugi != null) { try { ugi.doAs(new PrivilegedExceptionAction() { public Void run() throws IOException{ tracker.killTask(attemptidObj, false);// checks job modify permission return null; } }); } catch(AccessControlException e) { String errMsg = "User " + user + " failed to kill task " + attemptidObj + "!

" + e.getMessage() + "
Go back to Job
"; JSPUtil.setErrorAndForward(errMsg, request, response); return; } } else {// no authorization needed tracker.killTask(attemptidObj, false); } //redirect again so that refreshing the page will not attempt to rekill the task response.sendRedirect("/taskdetails.jsp?subaction=kill-task" + "&tipid=" + tipidObj.toString()); } else if (action.equalsIgnoreCase("fail-task") && request.getMethod().equalsIgnoreCase("POST")) { if (ugi != null) { try { ugi.doAs(new PrivilegedExceptionAction() { public Void run() throws IOException{ tracker.killTask(attemptidObj, true);// checks job modify permission return null; } }); } catch(AccessControlException e) { String errMsg = "User " + user + " failed to fail task " + attemptidObj + "!

" + e.getMessage() + "
Go back to Job
"; JSPUtil.setErrorAndForward(errMsg, request, response); return; } } else {// no authorization needed tracker.killTask(attemptidObj, true); } response.sendRedirect("/taskdetails.jsp?subaction=fail-task" + "&tipid=" + tipidObj.toString()); } } } TaskInProgress tip = job.getTaskInProgress(tipidObj); TaskStatus[] ts = null; boolean isCleanupOrSetup = false; if (tip != null) { ts = tip.getTaskStatuses(); isCleanupOrSetup = tip.isJobCleanupTask(); if (!isCleanupOrSetup) { isCleanupOrSetup = tip.isJobSetupTask(); } } out.write("\n\n\n\n\n \n Hadoop Task Details\n\n\n

Job '); out.print(jobid); out.write("

\n\n
\n\n

All Task Attempts

\n
\n"); if (ts == null || ts.length == 0) { out.write("\n\t\t

No Task Attempts found

\n"); } else { out.write("\n\n \n "); if (ts[0].getIsMap()) { out.write("\n\n "); } else if(!isCleanupOrSetup) { out.write("\n\n "); } out.write("\n\n "); for (int i = 0; i < ts.length; i++) { TaskStatus status = ts[i]; String taskTrackerName = status.getTaskTracker(); TaskTrackerStatus taskTracker = tracker.getTaskTrackerStatus(taskTrackerName); out.print(""); String taskAttemptTracker = null; String cleanupTrackerName = null; TaskTrackerStatus cleanupTracker = null; String cleanupAttemptTracker = null; boolean hasCleanupAttempt = false; if (tip != null && tip.isCleanupAttempt(status.getTaskID())) { cleanupTrackerName = tip.machineWhereCleanupRan(status.getTaskID()); cleanupTracker = tracker.getTaskTrackerStatus(cleanupTrackerName); if (cleanupTracker != null) { cleanupAttemptTracker = "http://" + cleanupTracker.getHost() + ":" + cleanupTracker.getHttpPort(); } hasCleanupAttempt = true; } out.print(""); out.print(""); out.print(""); out.print(""); if (ts[i].getIsMap()) { out.print(""); } else if (!isCleanupOrSetup) { out.print(""); out.println(""); } out.println(""); out.print(""); out.print(""); out.print(""); } out.write("\n
Task AttemptsMachineStatusProgressStart TimeMap Phase FinishedShuffle FinishedSort FinishedFinish TimeErrorsTask LogsCountersActions
" + status.getTaskID() + ""); if (hasCleanupAttempt) { out.print("Task attempt: "); } if (taskTracker == null) { out.print(taskTrackerName); } else { taskAttemptTracker = "http://" + taskTracker.getHost() + ":" + taskTracker.getHttpPort(); out.print("" + tracker.getNode(taskTracker.getHost()) + ""); } if (hasCleanupAttempt) { out.print("
Cleanup Attempt: "); if (cleanupAttemptTracker == null ) { out.print(cleanupTrackerName); } else { out.print("" + tracker.getNode(cleanupTracker.getHost()) + ""); } } out.print("
" + status.getRunState() + "" + StringUtils.formatPercent(status.getProgress(), 2) + ServletUtil.percentageGraph(status.getProgress() * 100f, 80) + "" + StringUtils.getFormattedTimeWithDiff(dateFormat, status .getStartTime(), 0) + "" + StringUtils.getFormattedTimeWithDiff(dateFormat, status .getMapFinishTime(), status.getStartTime()) + "" + StringUtils.getFormattedTimeWithDiff(dateFormat, status .getShuffleFinishTime(), status.getStartTime()) + "" + StringUtils.getFormattedTimeWithDiff(dateFormat, status .getSortFinishTime(), status.getShuffleFinishTime()) + "" + StringUtils.getFormattedTimeWithDiff(dateFormat, status .getFinishTime(), status.getStartTime()) + "
");
        String [] failures = tracker.getTaskDiagnostics(status.getTaskID());
        if (failures == null) {
          out.print(" ");
        } else {
          for(int j = 0 ; j < failures.length ; j++){
            out.print(HtmlQuoting.quoteHtmlChars(failures[j]));
            if (j < (failures.length - 1)) {
              out.print("\n-------\n");
            }
          }
        }
        out.print("
"); String taskLogUrl = null; if (taskTracker != null ) { taskLogUrl = TaskLogServlet.getTaskLogUrl(taskTracker.getHost(), String.valueOf(taskTracker.getHttpPort()), status.getTaskID().toString()); } if (hasCleanupAttempt) { out.print("Task attempt:
"); } if (taskLogUrl == null) { out.print("n/a"); } else { String tailFourKBUrl = taskLogUrl + "&start=-4097"; String tailEightKBUrl = taskLogUrl + "&start=-8193"; String entireLogUrl = taskLogUrl + "&all=true"; out.print("Last 4KB
"); out.print("Last 8KB
"); out.print("All
"); } if (hasCleanupAttempt) { out.print("Cleanup attempt:
"); taskLogUrl = null; if (cleanupTracker != null ) { taskLogUrl = TaskLogServlet.getTaskLogUrl(cleanupTracker.getHost(), String.valueOf(cleanupTracker.getHttpPort()), status.getTaskID().toString()); } if (taskLogUrl == null) { out.print("n/a"); } else { String tailFourKBUrl = taskLogUrl + "&start=-4097&cleanup=true"; String tailEightKBUrl = taskLogUrl + "&start=-8193&cleanup=true"; String entireLogUrl = taskLogUrl + "&all=true&cleanup=true"; out.print("Last 4KB
"); out.print("Last 8KB
"); out.print("All
"); } } out.print("
" + "" + ((status.getCounters() != null) ? status.getCounters().size() : 0) + ""); if (privateActions && status.getRunState() == TaskStatus.State.RUNNING) { out.print(" Kill "); out.print("
Fail "); } else out.print("
 
"); out.println("
\n
\n\n"); if (ts[0].getIsMap() && !isCleanupOrSetup) { out.write("\n

Input Split Locations

\n\n"); for (String split: StringUtils.split(tracker.getTip( tipidObj).getSplitNodes())) { out.println(""); } out.write("\n
" + split + "
\n"); } } out.write("\n\n
\nGo back to the job
\nGo back to JobTracker
\n"); out.println(ServletUtil.htmlFooter()); out.write('\n'); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy