hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yhema...@apache.org
Subject svn commit: r816147 - in /hadoop/mapreduce/trunk: ./ src/java/org/apache/hadoop/mapred/ src/test/mapred/org/apache/hadoop/mapred/ src/webapps/job/
Date Thu, 17 Sep 2009 11:30:40 GMT
Author: yhemanth
Date: Thu Sep 17 11:30:38 2009
New Revision: 816147

URL: http://svn.apache.org/viewvc?rev=816147&view=rev
Log:
MAPREDUCE-862. Enhance JobTracker UI to display hierarchical queues. Contributed by V.V.Chaitanya
Krishna.

Added:
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java
    hadoop/mapreduce/trunk/src/webapps/job/jobtable.jsp
    hadoop/mapreduce/trunk/src/webapps/job/queueinfo.jsp
    hadoop/mapreduce/trunk/src/webapps/job/queuetable.jsp
Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobQueueClient.java
    hadoop/mapreduce/trunk/src/webapps/job/jobqueue_details.jsp
    hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=816147&r1=816146&r2=816147&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Thu Sep 17 11:30:38 2009
@@ -105,6 +105,9 @@
     MAPREDUCE-776. Add Gridmix, a benchmark processing Rumen traces to simulate
     a measured mix of jobs on a cluster. (cdouglas)
 
+    MAPREDUCE-862. Enhance JobTracker UI to display hierarchical queues.
+    (V.V.Chaitanya Krishna via yhemanth)
+
   IMPROVEMENTS
 
     MAPREDUCE-816. Rename "local" mysql import to "direct" in Sqoop.

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobQueueClient.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobQueueClient.java?rev=816147&r1=816146&r2=816147&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobQueueClient.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/JobQueueClient.java Thu Sep 17
11:30:38 2009
@@ -18,41 +18,46 @@
 package org.apache.hadoop.mapred;
 
 import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.hadoop.conf.Configured;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
+
 /**
- * <code>JobQueueClient</code> is interface provided to the user in order
- * to get JobQueue related information from the {@link JobTracker}
+ * <code>JobQueueClient</code> is interface provided to the user in order to
get
+ * JobQueue related information from the {@link JobTracker}
  * 
- * It provides the facility to list the JobQueues present and ability to 
- * view the list of jobs within a specific JobQueue 
+ * It provides the facility to list the JobQueues present and ability to view
+ * the list of jobs within a specific JobQueue
  * 
-**/
+ **/
+
+class JobQueueClient extends Configured implements Tool {
 
-class JobQueueClient extends Configured implements  Tool {
-  
   JobClient jc;
-  
+
   public JobQueueClient() {
   }
-  
+
   public JobQueueClient(JobConf conf) throws IOException {
     setConf(conf);
   }
-  
+
   private void init(JobConf conf) throws IOException {
     setConf(conf);
     jc = new JobClient(conf);
   }
-  
+
   @Override
   public int run(String[] argv) throws Exception {
     int exitcode = -1;
-    
-    if(argv.length < 1){
+
+    if (argv.length < 1) {
       displayUsage("");
       return exitcode;
     }
@@ -61,102 +66,128 @@
     boolean displayQueueInfoWithJobs = false;
     boolean displayQueueInfoWithoutJobs = false;
     boolean displayQueueAclsInfoForCurrentUser = false;
-    
-    if("-list".equals(cmd)){
+
+    if ("-list".equals(cmd)) {
       displayQueueList = true;
-    }else if("-showacls".equals(cmd)) {
+    } else if ("-showacls".equals(cmd)) {
       displayQueueAclsInfoForCurrentUser = true;
-    }else if("-info".equals(cmd)){
-      if(argv.length == 2 && !(argv[1].equals("-showJobs"))) {
+    } else if ("-info".equals(cmd)) {
+      if (argv.length == 2 && !(argv[1].equals("-showJobs"))) {
         displayQueueInfoWithoutJobs = true;
-      } else if(argv.length == 3){
-        if(argv[2].equals("-showJobs")){
+      } else if (argv.length == 3) {
+        if (argv[2].equals("-showJobs")) {
           displayQueueInfoWithJobs = true;
-        }else {
+        } else {
           displayUsage(cmd);
           return exitcode;
         }
-      }else {
+      } else {
         displayUsage(cmd);
         return exitcode;
-      }      
+      }
     } else {
       displayUsage(cmd);
       return exitcode;
     }
+    
     JobConf conf = new JobConf(getConf());
     init(conf);
     if (displayQueueList) {
       displayQueueList();
       exitcode = 0;
-    } else if (displayQueueInfoWithoutJobs){
-      displayQueueInfo(argv[1],false);
+    } else if (displayQueueInfoWithoutJobs) {
+      displayQueueInfo(argv[1], false);
       exitcode = 0;
     } else if (displayQueueInfoWithJobs) {
-      displayQueueInfo(argv[1],true);
+      displayQueueInfo(argv[1], true);
       exitcode = 0;
-    }else if (displayQueueAclsInfoForCurrentUser) {
+    } else if (displayQueueAclsInfoForCurrentUser) {
       this.displayQueueAclsInfoForCurrentUser();
       exitcode = 0;
     }
-    
     return exitcode;
   }
-  
-  /**
-   * Method used to display information pertaining to a Single JobQueue 
-   * registered with the {@link QueueManager}. Display of the Jobs is 
-   * determine by the boolean 
-   * 
-   * @throws IOException
-   */
 
-  private void displayQueueInfo(String queue, boolean showJobs) throws IOException {
-    JobQueueInfo jobQueueInfo = jc.getQueueInfo(queue);
+  // format and print information about the passed in job queue.
+  void printJobQueueInfo(JobQueueInfo jobQueueInfo, Writer writer)
+      throws IOException {
     if (jobQueueInfo == null) {
-      System.out.printf("Queue Name : %s has no scheduling information \n", queue);
-    } else {
-      printJobQueueInfo(jobQueueInfo);
+      writer.write("No queue found.\n");
+      return;
     }
-    if (showJobs) {
-      System.out.printf("Job List\n");
-      JobStatus[] jobs = jc.getJobsFromQueue(queue);
-      if (jobs == null)
-        jobs = new JobStatus[0];
-      jc.displayJobList(jobs);
+    writer.write(String.format("Queue Name : %s \n",
+        jobQueueInfo.getQueueName()));
+    writer.write(String.format("Queue State : %s \n",
+        jobQueueInfo.getQueueState()));
+    writer.write(String.format("Scheduling Info : %s \n",
+        jobQueueInfo.getSchedulingInfo()));
+    List<JobQueueInfo> childQueues = jobQueueInfo.getChildren();
+    if (childQueues != null && childQueues.size() > 0) {
+      writer.write(String.format("Child Queues : "));
+      for (int i = 0; i < childQueues.size(); i++) {
+        JobQueueInfo childQueue = childQueues.get(i);
+        writer.write(String.format("%s", childQueue.getQueueName()));
+        if (i != childQueues.size() - 1) {
+          writer.write(String.format(", "));
+        }
+      }
+      writer.write("\n");
     }
+    writer.write(String.format("======================\n"));
   }
-
-  // format and print information about the passed in job queue.
-  private void printJobQueueInfo(JobQueueInfo jobQueueInfo) {
-    System.out.printf("Queue Name : %s \n", jobQueueInfo.getQueueName()); 
-    System.out.printf("Queue State : %s \n", jobQueueInfo.getQueueState());
-    System.out.printf("Scheduling Info : %s \n",jobQueueInfo.getSchedulingInfo());
+  
+  private void displayQueueList() throws IOException {
+    JobQueueInfo[] rootQueues = jc.getRootQueues();
+    List<JobQueueInfo> allQueues = expandQueueList(rootQueues);
+    for (JobQueueInfo queue : allQueues) {
+      printJobQueueInfo(queue, new PrintWriter(System.out));
+    }
   }
-
+  
+  /**
+   * Expands the hierarchy of queues and gives the list of all queues in 
+   * depth-first order
+   * @param rootQueues the top-level queues
+   * @return the list of all the queues in depth-first order.
+   */
+  List<JobQueueInfo> expandQueueList(JobQueueInfo[] rootQueues) {
+    List<JobQueueInfo> allQueues = new ArrayList<JobQueueInfo>();
+    for (JobQueueInfo queue : rootQueues) {
+      allQueues.add(queue);
+      if (queue.getChildren() != null) {
+        JobQueueInfo[] childQueues 
+          = queue.getChildren().toArray(new JobQueueInfo[0]);
+        allQueues.addAll(expandQueueList(childQueues));
+      }
+    }
+    return allQueues;
+  }
+ 
   /**
-   * Method used to display the list of the JobQueues registered
-   * with the {@link QueueManager}
+   * Method used to display information pertaining to a Single JobQueue
+   * registered with the {@link QueueManager}. Display of the Jobs is determine
+   * by the boolean
    * 
    * @throws IOException
    */
-  private void displayQueueList() throws IOException {
-    JobQueueInfo[] queues = jc.getQueues();
-    for (JobQueueInfo queue : queues) {
-      String schedInfo = queue.getSchedulingInfo();
-      if(schedInfo.trim().equals("")){
-        schedInfo = "N/A";
-      }
-      printJobQueueInfo(queue);
+  private void displayQueueInfo(String queue, boolean showJobs)
+      throws IOException {
+    JobQueueInfo jobQueueInfo = jc.getQueueInfo(queue);
+    printJobQueueInfo(jobQueueInfo, new PrintWriter(System.out));
+    if (showJobs && (jobQueueInfo.getChildren() == null ||
+        jobQueueInfo.getChildren().size() == 0)) {
+      JobStatus[] jobs = jc.getJobsFromQueue(queue);
+      if (jobs == null)
+        jobs = new JobStatus[0];
+      jc.displayJobList(jobs);
     }
   }
-
+   
   private void displayQueueAclsInfoForCurrentUser() throws IOException {
     QueueAclsInfo[] queueAclsInfoList = jc.getQueueAclsForCurrentUser();
     UserGroupInformation ugi = UserGroupInformation.readFrom(getConf());
     if (queueAclsInfoList.length > 0) {
-      System.out.println("Queue acls for user :  "
-              + ugi.getUserName());
+      System.out.println("Queue acls for user :  " + ugi.getUserName());
       System.out.println("\nQueue  Operations");
       System.out.println("=====================");
       for (QueueAclsInfo queueInfo : queueAclsInfoList) {
@@ -172,17 +203,16 @@
         System.out.println();
       }
     } else {
-      System.out.println("User " +
-              ugi.getUserName() +
-              " does not have access to any queue. \n");
+      System.out.println("User " + ugi.getUserName()
+          + " does not have access to any queue. \n");
     }
   }
-  
+
   private void displayUsage(String cmd) {
     String prefix = "Usage: JobQueueClient ";
-    if ("-queueinfo".equals(cmd)){
+    if ("-queueinfo".equals(cmd)) {
       System.err.println(prefix + "[" + cmd + "<job-queue-name> [-showJobs]]");
-    }else {
+    } else {
       System.err.printf(prefix + "<command> <args>\n");
       System.err.printf("\t[-list]\n");
       System.err.printf("\t[-info <job-queue-name> [-showJobs]]\n");
@@ -195,5 +225,5 @@
     int res = ToolRunner.run(new JobQueueClient(), argv);
     System.exit(res);
   }
-  
+
 }

Added: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java?rev=816147&view=auto
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java
(added)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapred/TestJobQueueClient.java
Thu Sep 17 11:30:38 2009
@@ -0,0 +1,79 @@
+/**
+ * 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.
+ */
+package org.apache.hadoop.mapred;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Test;
+
+public class TestJobQueueClient {
+  @Test
+  public void testQueueOrdering() throws Exception {
+    System.out.println("in test queue ordering");
+    // create some sample queues in a hierarchy..
+    JobQueueInfo[] roots = new JobQueueInfo[2];
+    roots[0] = new JobQueueInfo("q1", "q1 scheduling info");
+    roots[1] = new JobQueueInfo("q2", "q2 scheduling info");
+    
+    List<JobQueueInfo> children = new ArrayList<JobQueueInfo>();
+    children.add(new JobQueueInfo("q1:1", null));
+    children.add(new JobQueueInfo("q1:2", null));
+    roots[0].setChildren(children);
+    
+    // test dfs ordering
+    JobQueueClient client = new JobQueueClient(new JobConf());
+    List<JobQueueInfo> allQueues = client.expandQueueList(roots);
+    assertEquals(4, allQueues.size());
+    assertEquals("q1", allQueues.get(0).getQueueName());
+    assertEquals("q1:1", allQueues.get(1).getQueueName());
+    assertEquals("q1:2", allQueues.get(2).getQueueName());
+    assertEquals("q2", allQueues.get(3).getQueueName());
+  }
+  
+  @Test
+  public void testQueueInfoPrinting() throws Exception {
+    System.out.println("in test queue info printing");
+    // create a test queue with children.
+    // create some sample queues in a hierarchy..
+    JobQueueInfo root = new JobQueueInfo("q1", "q1 scheduling info");
+    
+    List<JobQueueInfo> children = new ArrayList<JobQueueInfo>();
+    children.add(new JobQueueInfo("q1:1", null));
+    children.add(new JobQueueInfo("q1:2", null));
+    root.setChildren(children);
+
+    JobQueueClient client = new JobQueueClient(new JobConf());
+    StringWriter writer = new StringWriter();
+    client.printJobQueueInfo(root, writer);
+    
+    StringBuffer sb = new StringBuffer();
+    sb.append("Queue Name : q1 \n");
+    sb.append("Queue State : running \n");
+    sb.append("Scheduling Info : q1 scheduling info \n");
+    sb.append("Child Queues : q1:1, q1:2\n");
+    sb.append("======================\n");
+    
+    assertEquals(sb.toString(), writer.toString());
+  }
+}
\ No newline at end of file

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobqueue_details.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobqueue_details.jsp?rev=816147&r1=816146&r2=816147&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobqueue_details.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobqueue_details.jsp Thu Sep 17 11:30:38 2009
@@ -1,22 +1,20 @@
-<%
-/*
- * 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.
- */
-%>
+<%/*
+       * 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.*"
@@ -27,28 +25,26 @@
   import="org.apache.hadoop.util.StringUtils"
   import="org.apache.hadoop.util.ServletUtil"
 %>
-<%!
-private static final long serialVersionUID = 526456771152222127L; 
-%>
+<%!private static final long serialVersionUID = 526456771152222127L;%>
 <%
-  JobTracker tracker = 
-    (JobTracker) application.getAttribute("job.tracker");
-  String trackerName = 
-    StringUtils.simpleHostname(tracker.getJobTrackerMachine());
-  String queueName = 
-    StringUtils.escapeHTML(request.getParameter("queueName"));
+  JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+  String trackerName = StringUtils.simpleHostname(tracker
+      .getJobTrackerMachine());
+  String queueName = StringUtils.escapeHTML(request
+      .getParameter("queueName"));
   TaskScheduler scheduler = tracker.getTaskScheduler();
-  Collection<JobInProgress> jobs = scheduler.getJobs(queueName);
   JobQueueInfo schedInfo = tracker.getQueueInfo(queueName);
 %>
 <html>
 <head>
-<title>Queue details for <%=queueName!=null?queueName:""%> </title>
+<title>Queue details for <%=queueName != null ? queueName : ""%> </title>
 <link rel="stylesheet" type="text/css" href="/static/hadoop.css">
 <script type="text/javascript" src="/static/jobtracker.js"></script>
 </head>
 <body>
-<% JSPUtil.processButtons(request, response, tracker); %>
+<%
+  JSPUtil.processButtons(request, response, tracker);
+%>
 <%
   String schedulingInfoString = schedInfo.getSchedulingInfo();
 %>
@@ -56,35 +52,52 @@
   <a href="jobtracker.jsp"><%=trackerName%></a>
 </h1>
 <div>
-State : <%= schedInfo.getQueueState() %> <br/>
-Scheduling Information : <%= schedulingInfoString.replaceAll("\n","<br/>") %>
+Scheduling Information : <%=schedulingInfoString.replaceAll("\n", "<br/>")%>
 </div>
 <hr/>
 <%
-if(jobs == null || jobs.isEmpty()) {
+  if (schedInfo.getChildren() != null && schedInfo.getChildren().size() > 0) {
+%>
+Child Queues : 
+<%
+    for (JobQueueInfo childQueue : schedInfo.getChildren()) {
+      String[] childNameSplits = childQueue.getQueueName().split(":");
+      String childName = childNameSplits[childNameSplits.length -1];
+%>
+      <a href="jobqueue_details.jsp?queueName=<%=childQueue.getQueueName()%>">
+      <%=childName%></a>&nbsp &nbsp
+<%
+    }
+%>
+<br/>
+<%
+  } else {
+    Collection<JobInProgress> jobs = scheduler.getJobs(queueName);
+    if (jobs == null || jobs.isEmpty()) {
 %>
 <center>
-<h2> No Jobs found for the Queue :: <%=queueName!=null?queueName:""%> </h2>
+<h2> No Jobs found for the Queue :: <%=queueName != null ? queueName : ""%> </h2>
 <hr/>
 </center>
 <%
-}else {
+  } else {
 %>
 <center>
-<h2> Job Summary for the Queue :: <%=queueName!=null?queueName:"" %> </h2>
+<h2> Job Summary for the Queue :: <%=queueName != null ? queueName : ""%> </h2>
 </center>
 <div style="text-align: center;text-indent: center;font-style: italic;">
 (In the order maintained by the scheduler)
 </div>
 <br/>
 <hr/>
-<%=
-  JSPUtil.generateJobTable("Job List", jobs, 30, 0)
-%>
+<%=JSPUtil.generateJobTable("Job List", jobs, 30, 0)%>
 <hr>
-<% } %>
+<%
+  }
+  }
+%>
 
 <%
-out.println(ServletUtil.htmlFooter());
+  out.println(ServletUtil.htmlFooter());
 %>
 

Added: hadoop/mapreduce/trunk/src/webapps/job/jobtable.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobtable.jsp?rev=816147&view=auto
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobtable.jsp (added)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobtable.jsp Thu Sep 17 11:30:38 2009
@@ -0,0 +1,73 @@
+<%
+/*
+ * 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="org.apache.hadoop.mapred.*"
+import="javax.servlet.*"
+import="javax.servlet.http.*"
+import="java.io.*"
+import="java.util.*"
+import="org.apache.hadoop.util.ServletUtil"
+%>
+<%!
+private static final long serialVersionUID = 1L;
+%>
+<%
+JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+QueueManager qmgr = tracker.getQueueManager();
+String queue = (String)request.getParameter("queue_name");
+TaskScheduler scheduler = tracker.getTaskScheduler();
+JobQueueInfo queueInfo = tracker.getQueueInfo(queue);
+%>
+<%
+if(queueInfo == null || (queueInfo.getChildren() != null &&
+    queueInfo.getChildren().size() != 0) ){
+%>
+<% 
+} else {
+%>
+<%
+Collection<JobInProgress> jobs = scheduler.getJobs(queue);
+String[] queueLabelSplits = queue.split(":");
+String queueLabel = 
+  queueLabelSplits.length==0?queue:queueLabelSplits[queueLabelSplits.length-1];
+
+if(jobs == null || jobs.isEmpty()) {
+%>
+<center>
+<h2><b> No Jobs found for the QueueName:: <%=queueLabel%> </b>
+</h2>
+</center>
+<%
+}else {
+%>
+<center>
+<p>
+<h1> Job Summary for the Queue :: <%=queueLabel%> </h1>
+(In the order maintained by the scheduler)
+<br/><br/><br/>
+<%=
+  JSPUtil.generateJobTable("Job List", jobs, 30, 5)
+%>
+</center>
+<%
+}
+%>
+<%} %>

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp?rev=816147&r1=816146&r2=816147&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp Thu Sep 17 11:30:38 2009
@@ -49,13 +49,16 @@
                       status.getMaxReduceTasks())) / status.getTaskTrackers()):
       "-";
     out.print("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"+
-              "<tr><th>Maps</th><th>Reduces</th>" + 
+              "<tr><th>Queues</th>" +
+              "<th>Maps</th><th>Reduces</th>" + 
               "<th>Total Submissions</th>" +
               "<th>Nodes</th><th>Map Task Capacity</th>" +
               "<th>Reduce Task Capacity</th><th>Avg. Tasks/Node</th>"
+ 
               "<th>Blacklisted Nodes</th>" +
               "<th>Excluded Nodes</th></tr>\n");
-    out.print("<tr><td>" + status.getMapTasks() + "</td><td>" +
+    out.print("<tr><td><a href=\"queueinfo.jsp\">" +
+              tracker.getRootQueues().length + "</a></td><td>" + 
+              status.getMapTasks() + "</td><td>" +
               status.getReduceTasks() + "</td><td>" + 
               tracker.getTotalSubmissions() +
               "</td><td><a href=\"machines.jsp?type=active\">" +
@@ -120,37 +123,6 @@
  generateSummaryTable(out, status, tracker); 
 %>
 <hr>
-<h2 id="scheduling_info">Scheduling Information</h2>
-<table border="2" cellpadding="5" cellspacing="2">
-<thead style="font-weight: bold">
-<tr>
-<td> Queue Name </td>
-<td> State </td>
-<td> Scheduling Information</td>
-</tr>
-</thead>
-<tbody>
-<%
-for(JobQueueInfo queue: queues) {
-  String queueName = queue.getQueueName();
-  String state = queue.getQueueState();
-  String schedulingInformation = queue.getSchedulingInfo();
-  if(schedulingInformation == null || schedulingInformation.trim().equals("")) {
-    schedulingInformation = "NA";
-  }
-%>
-<tr>
-<td><a href="jobqueue_details.jsp?queueName=<%=queueName%>"><%=queueName%></a></td>
-<td><%=state%></td>
-<td><%=schedulingInformation.replaceAll("\n","<br/>") %>
-</td>
-</tr>
-<%
-}
-%>
-</tbody>
-</table>
-<hr/>
 <b>Filter (Jobid, Priority, User, Name)</b> <input type="text" id="filter"
onkeyup="applyfilter()"> <br>
 <span class="small">Example: 'user:smith 3200' will filter by 'smith' only in the user
field and '3200' in all fields</span>
 <hr>

Added: hadoop/mapreduce/trunk/src/webapps/job/queueinfo.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/queueinfo.jsp?rev=816147&view=auto
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/queueinfo.jsp (added)
+++ hadoop/mapreduce/trunk/src/webapps/job/queueinfo.jsp Thu Sep 17 11:30:38 2009
@@ -0,0 +1,142 @@
+<%
+/*
+ * 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.
+ */
+%>
+<%!private static final long serialVersionUID = 1L;%>
+<%@ page
+contentType="text/html; charset=UTF-8"
+import="org.apache.hadoop.mapred.*"
+import="javax.servlet.*"
+import="javax.servlet.http.*"
+import="java.io.*"
+import="java.util.*"
+%>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Job Queue Information page</title>
+<link rel="stylesheet" type="text/css" href="/static/hadoop.css">
+<%
+  JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+  QueueManager qmgr = tracker.getQueueManager();
+  JobQueueInfo[] rootQueues = qmgr.getRootQueues();
+%>
+<%!
+  public static String getTree(String parent, JobQueueInfo[] rootQueues) {
+    List<JobQueueInfo> rootQueueList = new ArrayList<JobQueueInfo>();
+    for (JobQueueInfo queue : rootQueues) {
+      rootQueueList.add(queue);
+    }
+    return getTree(parent, rootQueueList);
+  }
+
+  private static String getTree(String parent, List<JobQueueInfo> children) {
+    StringBuilder str = new StringBuilder();
+    if (children == null) {
+      return "";
+    }
+    for (JobQueueInfo queueInfo : children) {
+      String variableName = queueInfo.getQueueName().replace(":", "_");
+      String label = queueInfo.getQueueName().split(":")[queueInfo
+          .getQueueName().split(":").length - 1];
+      str.append(String.format(
+          "var %sTreeNode = new YAHOO.widget.MenuNode(\"%s\", %s, false);\n",
+          variableName, label, parent));
+      str.append(String.format("%sTreeNode.data=\"%s\";\n", variableName,
+          queueInfo.getSchedulingInfo().replaceAll("\n", "<br/>")));
+      str.append(String.format("%sTreeNode.name=\"%s\";\n", variableName,
+          queueInfo.getQueueName()));
+      str.append(getTree(variableName + "TreeNode", queueInfo.getChildren()));
+    }
+    return str.toString();
+  }
+%>
+<style type="text/css">
+  /*margin and padding on body element
+    can introduce errors in determining
+    element position and are not recommended;
+    we turn them off as a foundation for YUI
+    CSS treatments. */
+  body {
+    margin:0;
+    padding:0;
+  }
+</style>
+<!-- Combo-handled YUI CSS files: --> 
+<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.7.0/build/fonts/fonts-min.css&2.7.0/build/grids/grids-min.css&2.7.0/build/base/base-min.css&2.7.0/build/assets/skins/sam/skin.css">

+<!-- Combo-handled YUI JS files: --> 
+<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.7.0/build/utilities/utilities.js&2.7.0/build/layout/layout-min.js&2.7.0/build/container/container_core-min.js&2.7.0/build/menu/menu-min.js&2.7.0/build/stylesheet/stylesheet-min.js&2.7.0/build/treeview/treeview-min.js"></script>
+</head>
+<body class="yui-skin-sam">
+<div id="left">
+<div id="queue_tree"></div>
+</div>
+<div id="right">
+  <div id="right_top" width="100%"></div>
+  <div style="text-align: center;"><h2><a href="jobtracker.jsp">Job Tracker</a>
+  </h2></div>
+</div>
+<script type = "text/javascript">
+if (typeof(YAHOO) == "undefined") {
+  window.location = "queuetable.jsp";
+}
+else {
+  (function() {
+    var tree;
+    YAHOO.util.Event.onDOMReady(function() {
+      var layout = new YAHOO.widget.Layout({
+        units : [
+          { position: 'center', body: 'right', scroll: true},
+          { position: 'left', width: 150, gutter: '5px', resize: true, 
+            body:'left',scroll: true, collapse:true,
+            header: '<center>Queues</center>'
+          }
+        ]
+      });
+      layout.on('render', function() {
+        function onLabelClick(node) {
+          var schedulingInfoDiv = document.getElementById('right_top');
+          schedulingInfoDiv.innerHTML = 
+            "<font size=\"+3\"><b><u>Scheduling Information for queue:
" +
+             node.label + "</u></b></font><br/><br/>" + node.data
+ "<hr/>";
+          var surl = 'jobtable.jsp?queue_name='+node.name;
+          var callback = 
+            {success: handleSuccess, failure: handleFailure, arguments: {}};
+          var request = YAHOO.util.Connect.asyncRequest('GET', surl, callback); 
+        }       
+        function handleSuccess(o) {
+    	  var jobtablediv = document.getElementById('right_top');
+          jobtablediv.innerHTML += o.responseText;
+        }
+        function handleFailure(o) {
+    	  var jobtablediv = document.getElementById('right_top');
+    	  jobtablediv.innerHTML = 'unable to retrieve jobs for the queue'; 
+        }
+        tree = new YAHOO.widget.TreeView("queue_tree");
+        <%=getTree("tree.getRoot()", rootQueues)%>
+        tree.subscribe("labelClick", onLabelClick);
+        tree.draw();
+        onLabelClick(tree.getRoot().children[0]);
+      });
+      layout.render();
+    });
+  })();
+}
+</script>
+</body>
+</html>

Added: hadoop/mapreduce/trunk/src/webapps/job/queuetable.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/queuetable.jsp?rev=816147&view=auto
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/queuetable.jsp (added)
+++ hadoop/mapreduce/trunk/src/webapps/job/queuetable.jsp Thu Sep 17 11:30:38 2009
@@ -0,0 +1,75 @@
+<%
+/*
+ * 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.
+ */
+%>
+<%!
+private static final long serialVersionUID = 1L; 
+%>
+<%@ page 
+  contentType="text/html; charset=UTF-8"
+  import="javax.servlet.*"
+  import="javax.servlet.http.*"
+  import="java.io.*"
+  import="java.util.*"
+  import="java.text.DecimalFormat"
+  import="org.apache.hadoop.mapred.*"
+  import="org.apache.hadoop.util.*"
+  import="org.apache.hadoop.util.ServletUtil"
+%>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<%
+JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+JobQueueInfo[] queues = tracker.getRootQueues();
+%>
+<title>Queue Information</title>
+</head>
+<body>
+<h2 id="scheduling_info">Scheduling Information</h2>
+<table border="2" cellpadding="5" cellspacing="2">
+<thead style="font-weight: bold">
+<tr>
+<td> Queue Name </td>
+<td> Scheduling Information</td>
+</tr>
+</thead>
+<tbody>
+<%
+for(JobQueueInfo queue: queues) {
+  String queueName = queue.getQueueName();
+  String state = queue.getQueueState();
+  String schedulingInformation = queue.getSchedulingInfo();
+  if(schedulingInformation == null || schedulingInformation.trim().equals("")) {
+    schedulingInformation = "NA";
+  }
+%>
+<tr>
+<td><a href="jobqueue_details.jsp?queueName=<%=queueName%>"><%=queueName%></a>
+</td>
+<td><%=schedulingInformation.replaceAll("\n","<br/>") %>
+</td>
+</tr>
+<%
+}
+%>
+</tbody>
+</table>
+<a href="jobtracker.jsp"><h2>Job Tracker</h2></a>
+</body>
+</html>



Mime
View raw message