You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by vi...@apache.org on 2011/09/12 16:28:03 UTC

svn commit: r1169767 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: ./ hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/ hadoop-mapreduce-client/hadoop-mapreduce-client-hs/s...

Author: vinodkv
Date: Mon Sep 12 14:28:02 2011
New Revision: 1169767

URL: http://svn.apache.org/viewvc?rev=1169767&view=rev
Log:
MAPREDUCE-2675. svn merge -c r1169763 --ignore-ancestry ../../trunk/

Added:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobBlock.java
      - copied unchanged from r1169763, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobBlock.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java
      - copied unchanged from r1169763, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java
Modified:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobPage.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsNavBlock.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Mon Sep 12 14:28:02 2011
@@ -253,6 +253,9 @@ Release 0.23.0 - Unreleased
     MAPREDUCE-2933. Change allocate call to return ContainerStatus for
     completed containers rather than Container. (acmurthy) 
 
+    MAPREDUCE-2675. Reformat JobHistory Server main page to be more
+    useful. (Robert Joseph Evans via vinodkv).
+
   OPTIMIZATIONS
 
     MAPREDUCE-2026. Make JobTracker.getJobCounters() and

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java Mon Sep 12 14:28:02 2011
@@ -22,6 +22,8 @@ import static org.apache.hadoop.yarn.uti
 
 import java.util.Locale;
 
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.mapreduce.v2.api.records.JobId;
@@ -187,7 +189,7 @@ public class AppController extends Contr
    * @param s the error message to include.
    */
   void badRequest(String s) {
-    setStatus(response().SC_BAD_REQUEST);
+    setStatus(HttpServletResponse.SC_BAD_REQUEST);
     setTitle(join("Bad request: ", s));
   }
 
@@ -196,7 +198,7 @@ public class AppController extends Contr
    * @param s the error message to include.
    */
   void notFound(String s) {
-    setStatus(response().SC_NOT_FOUND);
+    setStatus(HttpServletResponse.SC_NOT_FOUND);
     setTitle(join("Not found: ", s));
   }
 

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistory.java Mon Sep 12 14:28:02 2011
@@ -224,7 +224,7 @@ public class JobHistory extends Abstract
             DEFAULT_MOVE_THREAD_INTERVAL);
     numMoveThreads = conf.getInt(JHAdminConfig.MR_HISTORY_MOVE_THREAD_COUNT, DEFAULT_MOVE_THREAD_COUNT);
     try {
-    initExisting();
+      initExisting();
     } catch (IOException e) {
       throw new YarnException("Failed to intialize existing directories", e);
     }
@@ -319,6 +319,7 @@ public class JobHistory extends Abstract
    */
   @SuppressWarnings("unchecked")
   private void initExisting() throws IOException {
+    LOG.info("Initializing Existing Jobs...");
     List<FileStatus> timestampedDirList = findTimestampedDirectories();
     Collections.sort(timestampedDirList);
     for (FileStatus fs : timestampedDirList) {
@@ -350,6 +351,9 @@ public class JobHistory extends Abstract
   }
   
   private void addDirectoryToSerialNumberIndex(Path serialDirPath) {
+    if(LOG.isDebugEnabled()) {
+      LOG.debug("Adding "+serialDirPath+" to serial index");
+    }
     String serialPart = serialDirPath.getName();
     String timestampPart = JobHistoryUtils.getTimestampPartFromPath(serialDirPath.toString());
     if (timestampPart == null) {
@@ -374,9 +378,15 @@ public class JobHistory extends Abstract
   }
   
   private void addDirectoryToJobListCache(Path path) throws IOException {
+    if(LOG.isDebugEnabled()) {
+      LOG.debug("Adding "+path+" to job list cache.");
+    }
     List<FileStatus> historyFileList = scanDirectoryForHistoryFiles(path,
         doneDirFc);
     for (FileStatus fs : historyFileList) {
+      if(LOG.isDebugEnabled()) {
+        LOG.debug("Adding in history for "+fs.getPath());
+      }
       JobIndexInfo jobIndexInfo = FileNameIndexUtils.getIndexInfo(fs.getPath()
           .getName());
       String confFileName = JobHistoryUtils
@@ -423,6 +433,9 @@ public class JobHistory extends Abstract
    * Adds an entry to the job list cache. Maintains the size.
    */
   private void addToJobListCache(JobId jobId, MetaInfo metaInfo) {
+    if(LOG.isDebugEnabled()) {
+      LOG.debug("Adding "+jobId+" to job list cache with "+metaInfo.getJobIndexInfo());
+    }
     jobListCache.put(jobId, metaInfo);
     if (jobListCache.size() > jobListCacheSize) {
       jobListCache.remove(jobListCache.firstKey());
@@ -432,7 +445,10 @@ public class JobHistory extends Abstract
   /**
    * Adds an entry to the loaded job cache. Maintains the size.
    */
-  private void  addToLoadedJobCache(Job job) {
+  private void addToLoadedJobCache(Job job) {
+    if(LOG.isDebugEnabled()) {
+      LOG.debug("Adding "+job.getID()+" to loaded job cache");
+    }
     loadedJobCache.put(job.getID(), job);
     if (loadedJobCache.size() > loadedJobCacheSize ) {
       loadedJobCache.remove(loadedJobCache.firstKey());
@@ -967,6 +983,9 @@ public class JobHistory extends Abstract
 
   @Override
   public synchronized Job getJob(JobId jobId) {
+    if(LOG.isDebugEnabled()) {
+      LOG.debug("Looking for Job "+jobId);
+    }
     Job job = null;
     try {
       job = findJob(jobId);
@@ -979,7 +998,9 @@ public class JobHistory extends Abstract
 
   @Override
   public Map<JobId, Job> getAllJobs(ApplicationId appID) {
-    LOG.info("Called getAllJobs(AppId): " + appID);
+    if(LOG.isDebugEnabled()) {
+      LOG.debug("Called getAllJobs(AppId): " + appID);
+    }
 //    currently there is 1 to 1 mapping between app and job id
     org.apache.hadoop.mapreduce.JobID oldJobID = TypeConverter.fromYarn(appID);
     Map<JobId, Job> jobs = new HashMap<JobId, Job>();
@@ -1002,12 +1023,9 @@ public class JobHistory extends Abstract
    * This does involve a DFS oepration of scanning the intermediate directory.
    */
   public Map<JobId, Job> getAllJobs() {
+    LOG.debug("Called getAllJobs()");
     return getAllJobsInternal();
-        }
-
-  
-  
-  
+  }
   
   static class MetaInfo {
     private Path historyFile;

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/PartialJob.java Mon Sep 12 14:28:02 2011
@@ -46,6 +46,8 @@ public class PartialJob implements org.a
     this.jobIndexInfo = jobIndexInfo;
     this.jobId = jobId;
     jobReport = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(JobReport.class);
+    jobReport.setStartTime(jobIndexInfo.getSubmitTime());
+    jobReport.setFinishTime(jobIndexInfo.getFinishTime());
   }
   
   @Override
@@ -142,7 +144,7 @@ public class PartialJob implements org.a
   
   @Override
   public String getUserName() {
-    return null;
+    return jobIndexInfo.getUser();
   }
 
 }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobPage.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobPage.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobPage.java Mon Sep 12 14:28:02 2011
@@ -23,7 +23,6 @@ import static org.apache.hadoop.yarn.uti
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
 
-import org.apache.hadoop.mapreduce.v2.app.webapp.JobBlock;
 import org.apache.hadoop.yarn.webapp.SubView;
 
 /**
@@ -46,9 +45,9 @@ public class HsJobPage extends HsView {
 
   /**
    * The content of this page is the JobBlock
-   * @return JobBlock.class
+   * @return HsJobBlock.class
    */
   @Override protected Class<? extends SubView> content() {
-    return JobBlock.class;
+    return HsJobBlock.class;
   }
 }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsNavBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsNavBlock.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsNavBlock.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsNavBlock.java Mon Sep 12 14:28:02 2011
@@ -43,7 +43,7 @@ public class HsNavBlock extends HtmlBloc
       div("#nav").
       h3("Application").
         ul().
-          li().a("about", "About")._().
+          li().a(url("about"), "About")._().
           li().a(url("app"), "Jobs")._()._();
     if (app.getJob() != null) {
       String jobid = MRApps.toString(app.getJob().getID());

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java Mon Sep 12 14:28:02 2011
@@ -18,11 +18,18 @@
 
 package org.apache.hadoop.mapreduce.v2.hs.webapp;
 
-import org.apache.hadoop.mapreduce.v2.app.webapp.JobsBlock;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION_ID;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.THEMESWITCHER_ID;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.postInitID;
+import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit;
+
 import org.apache.hadoop.yarn.webapp.SubView;
 import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout;
 
-import static org.apache.hadoop.yarn.webapp.view.JQueryUI.*;
 
 /**
  * A view that should be used as the base class for all history server pages.
@@ -36,6 +43,7 @@ public class HsView extends TwoColumnLay
     commonPreHead(html);
     set(DATATABLES_ID, "jobs");
     set(initID(DATATABLES, "jobs"), jobsTableInit());
+    set(postInitID(DATATABLES, "jobs"), jobsPostTableInit());
     setTableStyles(html, "jobs");
   }
 
@@ -64,7 +72,7 @@ public class HsView extends TwoColumnLay
    */
   @Override
   protected Class<? extends SubView> content() {
-    return JobsBlock.class;
+    return HsJobsBlock.class;
   }
   
   //TODO We need a way to move all of the javascript/CSS that is for a subview
@@ -76,9 +84,40 @@ public class HsView extends TwoColumnLay
    */
   private String jobsTableInit() {
     return tableInit().
-        append(",aoColumns:[{sType:'title-numeric'},").
-        append("null,null,{sType:'title-numeric', bSearchable:false},null,").
-        append("null,{sType:'title-numeric',bSearchable:false}, null, null]}").
+        append(",aoColumnDefs:[").
+        append("{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 6 ] }").
+        append(",{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 7 ] }").
+        append(",{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 8 ] }").
+        append(",{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 9 ] }").
+        append("]}").
         toString();
   }
+  
+  /**
+   * @return javascript to add into the jquery block after the table has
+   *  been initialized. This code adds in per field filtering.
+   */
+  private String jobsPostTableInit() {
+    return "var asInitVals = new Array();\n" +
+    		   "$('tfoot input').keyup( function () \n{"+
+           "  jobsDataTable.fnFilter( this.value, $('tfoot input').index(this) );\n"+
+           "} );\n"+
+           "$('tfoot input').each( function (i) {\n"+
+           "  asInitVals[i] = this.value;\n"+
+           "} );\n"+
+           "$('tfoot input').focus( function () {\n"+
+           "  if ( this.className == 'search_init' )\n"+
+           "  {\n"+
+           "    this.className = '';\n"+
+           "    this.value = '';\n"+
+           "  }\n"+
+           "} );\n"+
+           "$('tfoot input').blur( function (i) {\n"+
+           "  if ( this.value == '' )\n"+
+           "  {\n"+
+           "    this.className = 'search_init';\n"+
+           "    this.value = asInitVals[$('tfoot input').index(this)];\n"+
+           "  }\n"+
+           "} );\n";
+  }
 }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java?rev=1169767&r1=1169766&r2=1169767&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java Mon Sep 12 14:28:02 2011
@@ -133,8 +133,12 @@ public class JQueryUI extends HtmlBlock 
         if (init.isEmpty()) {
           init = defaultInit;
         }
-        list.add(join("  $('#", id, "').dataTable(", init,
+        list.add(join(id,"DataTable =  $('#", id, "').dataTable(", init,
                       ").fnSetFilteringDelay(188);"));
+        String postInit = $(postInitID(DATATABLES, id));
+        if(!postInit.isEmpty()) {
+          list.add(postInit);
+        }
       }
     }
     String selector = $(DATATABLES_SELECTOR);
@@ -210,6 +214,10 @@ public class JQueryUI extends HtmlBlock 
   public static String initID(String name, String id) {
     return djoin(name, id, "init");
   }
+  
+  public static String postInitID(String name, String id) {
+    return djoin(name, id, "postinit");
+  }
 
   public static String initSelector(String name) {
     return djoin(name, "selector.init");