hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r941179 - in /hadoop/mapreduce/trunk: ./ src/test/ src/test/mapred/org/apache/hadoop/mapred/ src/webapps/job/
Date Wed, 05 May 2010 07:16:58 GMT
Author: sharad
Date: Wed May  5 07:16:57 2010
New Revision: 941179

URL: http://svn.apache.org/viewvc?rev=941179&view=rev
Log:
MAPREDUCE-1546. Redirect all job pages to corresponding history page if job is not in JT memory.
Contributed by Scott Chen.

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/test/findbugsExcludeFile.xml
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobRetire.java
    hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp
    hadoop/mapreduce/trunk/src/webapps/job/jobtasks.jsp
    hadoop/mapreduce/trunk/src/webapps/job/taskdetails.jsp
    hadoop/mapreduce/trunk/src/webapps/job/taskstats.jsp

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Wed May  5 07:16:57 2010
@@ -8,6 +8,9 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
 
+  MAPREDUCE-1546. Redirect all job pages to corresponding history page 
+  if job is not in JT memory. (Scott Chen via sharad)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/mapreduce/trunk/src/test/findbugsExcludeFile.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/findbugsExcludeFile.xml?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/findbugsExcludeFile.xml (original)
+++ hadoop/mapreduce/trunk/src/test/findbugsExcludeFile.xml Wed May  5 07:16:57 2010
@@ -64,6 +64,14 @@
        <Class name="org.apache.hadoop.mapred.jobdetails_jsp"/>
        <Bug pattern="HRS_REQUEST_PARAMETER_TO_HTTP_HEADER"/>
      </Match>
+     <Match>
+       <Class name="org.apache.hadoop.mapred.taskstats_jsp"/>
+       <Bug pattern="HRS_REQUEST_PARAMETER_TO_HTTP_HEADER"/>
+     </Match>
+     <Match>
+       <Class name="org.apache.hadoop.mapred.jobtasks_jsp"/>
+       <Bug pattern="HRS_REQUEST_PARAMETER_TO_HTTP_HEADER"/>
+     </Match>
      <!--
        Ignore warnings where child class has the same name as
        super class. Classes based on Old API shadow names from

Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobRetire.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobRetire.java?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobRetire.java (original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobRetire.java Wed
May  5 07:16:57 2010
@@ -33,6 +33,8 @@ import org.apache.hadoop.mapred.MiniMRCl
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.SleepJob;
 import org.apache.hadoop.mapreduce.TaskType;
+import org.apache.hadoop.mapreduce.TaskID;
+import org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser;
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
 import org.apache.hadoop.mapreduce.server.tasktracker.TTConfig;
 import org.apache.hadoop.mapreduce.split.JobSplit;
@@ -102,20 +104,59 @@ public class TestJobRetire extends TestC
  
     assertFalse("JobConf file not deleted", file.exists());
     
-    //test redirection
-    URL jobUrl = new URL(rj.getTrackingURL());
-    HttpURLConnection conn = (HttpURLConnection) jobUrl.openConnection();
+    // test redirections
+    final String JOBDETAILS = "jobdetails";
+    final String JOBCONF = "jobconf";
+    final String JOBTASKS = "jobtasks";
+    final String TASKSTATS = "taskstats";
+    final String TASKDETAILS = "taskdetails";
+
+    // test redirections of job related pages
+    String jobUrlStr = rj.getTrackingURL();
+    URL jobUrl = new URL(jobUrlStr);
+    URL jobConfUrl = new URL(jobUrlStr.replace(JOBDETAILS, JOBCONF));
+    URL jobTasksUrl = new URL(jobUrlStr.replace(JOBDETAILS, JOBTASKS)
+                              + "&type=map&pagenum=1");
+    verifyRedirection(jobConfUrl);
+    verifyRedirection(jobTasksUrl);
+    verifyRedirection(jobUrl);
+
+    // test redirections of task and task attempt pages
+    String jobTrackerUrlStr =
+        jobUrlStr.substring(0, jobUrlStr.indexOf(JOBDETAILS));
+    Path logFile = new Path(jobtracker.getJobHistory().getHistoryFilePath(id));
+    JobHistoryParser.JobInfo jobInfo =
+      JSPUtil.getJobInfo(logFile, logFile.getFileSystem(jobConf), jobtracker);
+    for (TaskID tid : jobInfo.getAllTasks().keySet()) {
+      URL taskDetailsUrl = new URL(jobTrackerUrlStr + TASKDETAILS +
+                                   ".jsp?tipid=" + tid);
+      // test redirections of all tasks
+      verifyRedirection(taskDetailsUrl);
+    }
+    for (JobHistoryParser.TaskInfo task : jobInfo.getAllTasks().values()) {
+      for(org.apache.hadoop.mapreduce.TaskAttemptID attemptid :
+          task.getAllTaskAttempts().keySet()) {
+        URL taskstats = new URL(jobTrackerUrlStr + TASKSTATS +
+            ".jsp?attemptid=" + attemptid);
+        // test redirections of all task attempts
+        verifyRedirection(taskstats);
+      }
+    }
+    return id;
+  }
+
+  private void verifyRedirection(URL url) throws IOException {
+    LOG.info("Verifying redirection of " + url);
+    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
     conn.setInstanceFollowRedirects(false);
     conn.connect();
     assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, conn.getResponseCode());
     conn.disconnect();
-    
     URL redirectedUrl = new URL(conn.getHeaderField("Location"));
     conn = (HttpURLConnection) redirectedUrl.openConnection();
     conn.connect();
     assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
     conn.disconnect();
-    return id;
   }
 
   // wait till the job retires

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobconf.jsp Wed May  5 07:16:57 2010
@@ -49,15 +49,23 @@
 
 <%
 
+  final JobID jobIdObj = JobID.forName(jobId);
   JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker,
-      JobID.forName(jobId), request, response);
+      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) {
-    out.print("<b>Job " + jobId + " not found.</b><br>\n");
+    String historyFile = tracker.getJobHistory().getHistoryFilePath(jobIdObj);
+    if (historyFile == null) {
+      out.println("<h2>Job " + jobId + " not known!</h2>");
+      return;
+    }
+    String historyUrl = "/jobconf_history.jsp?logFile=" + historyFile;
+    response.sendRedirect(response.encodeRedirectURL(historyUrl));
     return;
   }
 

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobtasks.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobtasks.jsp?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobtasks.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobtasks.jsp Wed May  5 07:16:57 2010
@@ -85,8 +85,17 @@
 <a href="jobdetails.jsp?jobid=<%=jobid%>"><%=jobid%></a> on 
 <a href="jobtracker.jsp"><%=trackerName%></a></h1>
 <%
-    if (job == null) {
-    out.print("<b>Job " + jobid + " not found.</b><br>\n");
+  // 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("<h2>Job " + jobid + " not known!</h2>");
+      return;
+    }
+    String historyUrl = "/jobtaskshistory.jsp?logFile=" + historyFile +
+                        "&status=" + state + "&taskType=" + type;
+    response.sendRedirect(response.encodeRedirectURL(historyUrl));
     return;
   }
   // Filtering the reports if some filter is specified

Modified: hadoop/mapreduce/trunk/src/webapps/job/taskdetails.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/taskdetails.jsp?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/taskdetails.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/taskdetails.jsp Wed May  5 07:16:57 2010
@@ -78,8 +78,16 @@
     }
 
     JobInProgress job = myJob.getJob();
+    // redirect to history page if it cannot be found in memory
     if (job == null) {
-      out.print("<b>Job " + jobid + " not found.</b><br>\n");
+      String historyFile = tracker.getJobHistory().getHistoryFilePath(jobidObj);
+      if (historyFile == null) {
+        out.println("<h2>Job " + jobid + " not known!</h2>");
+        return;
+      }
+      String historyUrl = "/taskdetailshistory.jsp?logFile=" + historyFile +
+                          "&tipid=" + tipidObj.toString();
+      response.sendRedirect(response.encodeRedirectURL(historyUrl));
       return;
     }
     boolean privateActions = JSPUtil.privateActionsAllowed(tracker.conf);

Modified: hadoop/mapreduce/trunk/src/webapps/job/taskstats.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/taskstats.jsp?rev=941179&r1=941178&r2=941179&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/taskstats.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/taskstats.jsp Wed May  5 07:16:57 2010
@@ -55,8 +55,17 @@
   }
 
   JobInProgress job = myJob.getJob();
+  // redirect to history page if it cannot be found in memory
   if (job == null) {
-    out.print("<b>Job " + jobid + " not found.</b><br>\n");
+    JobID jobIdObj = JobID.forName(jobid);
+    String historyFile = tracker.getJobHistory().getHistoryFilePath(jobIdObj);
+    if (historyFile == null) {
+      out.println("<h2>Job " + jobid + " not known!</h2>");
+      return;
+    }
+    String historyUrl = "/taskstatshistory.jsp?logFile=" + historyFile +
+                        "&attemptid=" + attemptid;
+    response.sendRedirect(response.encodeRedirectURL(historyUrl));
     return;
   }
 



Mime
View raw message