hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r549209 - in /lucene/hadoop/trunk: CHANGES.txt conf/hadoop-default.xml src/java/org/apache/hadoop/dfs/JspHelper.java src/webapps/job/jobdetails.jsp src/webapps/job/jobtracker.jsp
Date Wed, 20 Jun 2007 19:33:54 GMT
Author: cutting
Date: Wed Jun 20 12:33:53 2007
New Revision: 549209

URL: http://svn.apache.org/viewvc?view=rev&rev=549209
Log:
HADOOP-1484.  Permit one to kill jobs from the web ui.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/conf/hadoop-default.xml
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/JspHelper.java
    lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp
    lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=549209&r1=549208&r2=549209
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Jun 20 12:33:53 2007
@@ -188,6 +188,11 @@
  58. HADOOP-1505.  Remove spurious stacktrace in ZlibFactory
      introduced in HADOOP-1093.  (Michael Stack via tomwhite)
 
+ 59. HADOOP-1484.  Permit one to kill jobs from the web ui.  Note that
+     this is disabled by default.  One must set
+     "webinterface.private.actions" to enable this.
+     (Enis Soztutar via cutting)
+
 
 Release 0.13.0 - 2007-06-08
 

Modified: lucene/hadoop/trunk/conf/hadoop-default.xml
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/conf/hadoop-default.xml?view=diff&rev=549209&r1=549208&r2=549209
==============================================================================
--- lucene/hadoop/trunk/conf/hadoop-default.xml (original)
+++ lucene/hadoop/trunk/conf/hadoop-default.xml Wed Jun 20 12:33:53 2007
@@ -912,4 +912,16 @@
                 calls</description>
 </property>
 
+<!-- Web Interface Configuration -->
+
+<property>
+  <name>webinterface.private.actions</name>
+  <value>false</value>
+  <description> If set to true, the web interfaces of JT and NN may contain 
+                actions, such as kill job, delete file, etc., that should 
+                not be exposed to public. Enable this option if the interfaces 
+                are only reachable by those who have the right authorization.
+  </description>
+</property>
+
 </configuration>

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/JspHelper.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/JspHelper.java?view=diff&rev=549209&r1=549208&r2=549209
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/JspHelper.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/JspHelper.java Wed Jun 20 12:33:53
2007
@@ -32,7 +32,7 @@
 public class JspHelper {
   static FSNamesystem fsn = null;
   static InetSocketAddress nameNodeAddr;
-  static Configuration conf = new Configuration();
+  public static Configuration conf = new Configuration();
 
   static int defaultChunkSizeToView = 
     conf.getInt("dfs.default.chunk.view.size", 32 * 1024);

Modified: lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp?view=diff&rev=549209&r1=549208&r2=549209
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp Wed Jun 20 12:33:53 2007
@@ -8,10 +8,14 @@
   import="java.text.DecimalFormat"
   import="org.apache.hadoop.mapred.*"
   import="org.apache.hadoop.util.*"
+  import="org.apache.hadoop.dfs.JspHelper"
 %>
 
 <%!
   
+	private static final String PRIVATE_ACTIONS_KEY 
+		= "webinterface.private.actions";
+
   JobTracker tracker = JobTracker.getTracker();
   String trackerName = 
            StringUtils.simpleHostname(tracker.getJobTrackerMachine());
@@ -70,6 +74,18 @@
                   ) + 
               "</td></tr>\n");
   }
+  
+  private void printConfirm(JspWriter out, String jobId) throws IOException{
+    String url = "jobdetails.jsp?jobid=" + jobId;
+    out.print("<html><head><META http-equiv=\"refresh\" content=\"15;URL="
+        + url+"\"></head>"
+        + "<body><h3> Are you sure you want to kill " + jobId
+        + " ?<h3><br><table border=\"0\"><tr><td width=\"100\">"
+        + "<a href=\"" +  url + "&action=kill"
+        + "\">Kill</a></td><td width=\"100\"><a href=\"" + url
+        + "\">Don't Kill</a></td></tr></table></body></html>");
+  }
+  
 %>       
 <%   
     String jobId = request.getParameter("jobid"); 
@@ -83,6 +99,19 @@
         catch (NumberFormatException ignored) {
         }
     }
+    
+    JobInProgress job = (JobInProgress) tracker.getJob(jobId);
+    
+    if(JspHelper.conf.getBoolean(PRIVATE_ACTIONS_KEY, false)) {
+    	String action = request.getParameter("action");
+	    if(action!=null && action.equalsIgnoreCase("confirm")) {
+  	      printConfirm(out, jobId);
+    	    return;
+	    }
+  	  else if(action != null && action.equalsIgnoreCase("kill")) {
+				job.kill();
+	    }
+    }
 %>
 
 <html>
@@ -100,7 +129,6 @@
 <h1>Hadoop <%=jobId%> on <a href="/jobtracker.jsp"><%=trackerName%></a></h1>
 
 <% 
-    JobInProgress job = (JobInProgress) tracker.getJob(jobId);
     if (job == null) {
       out.print("<b>Job " + jobId + " not found.</b><br>\n");
       return;
@@ -117,17 +145,27 @@
     } else {
       out.print("<b>Job File:</b> " + profile.getJobFile() + "<br>\n");
     }
-    out.print("<b>Started at:</b> " + new Date(job.getStartTime()) + "<br>\n");
     if (runState == JobStatus.RUNNING) {
       out.print("<b>Status:</b> Running<br>\n");
+      out.print("<b>Started at:</b> " + new Date(job.getStartTime()) + "<br>\n");
+      out.print("<b>Runnning for:</b> " + StringUtils.formatTimeDiff(
+          System.currentTimeMillis(), job.getStartTime()) + "<br>\n");
     } else {
       if (runState == JobStatus.SUCCEEDED) {
         out.print("<b>Status:</b> Succeeded<br>\n");
+        out.print("<b>Started at :</b> " + new Date(job.getStartTime()) + "<br>\n");
+        out.print("<b>Finished at:</b> " + new Date(job.getFinishTime()) +
+                  "<br>\n");
+        out.print("<b>Finished in:</b> " + StringUtils.formatTimeDiff(
+            job.getFinishTime(), job.getStartTime()) + "<br>\n");
       } else if (runState == JobStatus.FAILED) {
         out.print("<b>Status:</b> Failed<br>\n");
+        out.print("<b>Started at:</b> " + new Date(job.getStartTime()) + "<br>\n");
+        out.print("<b>Failed at :</b> " + new Date(job.getFinishTime()) +
+                  "<br>\n");
+        out.print("<b>Failed in :</b> " + StringUtils.formatTimeDiff(
+            job.getFinishTime(), job.getStartTime()) + "<br>\n");
       }
-      out.print("<b>Finished at:</b> " + new Date(job.getFinishTime()) +
-                "<br>\n");
     }
     if (flakyTaskTrackers > 0) {
       out.print("<b>Black-listed TaskTrackers:</b> " + 
@@ -195,6 +233,11 @@
     %>
     </table>
 
+
+<% if(JspHelper.conf.getBoolean(PRIVATE_ACTIONS_KEY, false) 
+    	&& runState == JobStatus.RUNNING) { %>
+	<hr><a href="jobdetails.jsp?action=confirm&jobid=<%=jobId%>"> Kill
this job </a>
+<% } %>
 <hr>
 <a href="/jobtracker.jsp">Go back to JobTracker</a><br>
 <a href="http://lucene.apache.org/hadoop">Hadoop</a>, 2006.<br>

Modified: lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp?view=diff&rev=549209&r1=549208&r2=549209
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp Wed Jun 20 12:33:53 2007
@@ -64,10 +64,12 @@
     ClusterStatus status = tracker.getClusterStatus();
     out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n"+
               "<tr><th>Maps</th><th>Reduces</th>" + 
-              "<th>Tasks/Node</th><th>Nodes</th></tr>\n");
+              "<th>Tasks/Node</th><th>Total Submissions</th>" +
+              "<th>Nodes</th></tr>\n");
     out.print("<tr><td>" + status.getMapTasks() + "</td><td>" +
               status.getReduceTasks() + "</td><td>" + 
-              status.getMaxTasks() + "</td><td><a href=\"/machines.jsp\">"
+
+              status.getMaxTasks() + "</td><td>" +
+              tracker.getTotalSubmissions() + "</td><td><a href=\"/machines.jsp\">"
+
               status.getTaskTrackers() + "</a></td></tr></table>\n");
   }
 %>



Mime
View raw message