hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yhema...@apache.org
Subject svn commit: r764287 - in /hadoop/core/trunk: CHANGES.txt src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java src/mapred/org/apache/hadoop/mapred/JSPUtil.java
Date Sun, 12 Apr 2009 08:56:45 GMT
Author: yhemanth
Date: Sun Apr 12 08:56:43 2009
New Revision: 764287

URL: http://svn.apache.org/viewvc?rev=764287&view=rev
Log:
HADOOP-5485. Mask actions in the fair scheduler's servlet UI based on value of webinterface.private.actions.
Contributed by Vinod Kumar Vavilapalli.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JSPUtil.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=764287&r1=764286&r2=764287&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Sun Apr 12 08:56:43 2009
@@ -219,6 +219,10 @@
     HADOOP-5502. Documentation for backup and checkpoint nodes.
     (Jakob Homan via shv)
 
+    HADOOP-5485. Mask actions in the fair scheduler's servlet UI based on
+    value of webinterface.private.actions. 
+    (Vinod Kumar Vavilapalli via yhemanth)
+
   OPTIMIZATIONS
 
     HADOOP-5595. NameNode does not need to run a replicator to choose a

Modified: hadoop/core/trunk/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java?rev=764287&r1=764286&r2=764287&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java
(original)
+++ hadoop/core/trunk/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairSchedulerServlet.java
Sun Apr 12 08:56:43 2009
@@ -80,12 +80,14 @@
     // If the request has a set* param, handle that and redirect to the regular
     // view page so that the user won't resubmit the data if they hit refresh.
     boolean advancedView = request.getParameter("advanced") != null;
-    if (request.getParameter("setFifo") != null) {
+    if (JSPUtil.privateActionsAllowed()
+        && request.getParameter("setFifo") != null) {
       scheduler.setUseFifo(request.getParameter("setFifo").equals("true"));
       response.sendRedirect("/scheduler" + (advancedView ? "?advanced" : ""));
       return;
     }
-    if (request.getParameter("setPool") != null) {
+    if (JSPUtil.privateActionsAllowed()
+        && request.getParameter("setPool") != null) {
       Collection<JobInProgress> runningJobs = jobTracker.getRunningJobs();
       PoolManager poolMgr = null;
       synchronized (scheduler) {
@@ -105,7 +107,8 @@
       response.sendRedirect("/scheduler" + (advancedView ? "?advanced" : ""));
       return;
     }
-    if (request.getParameter("setPriority") != null) {
+    if (JSPUtil.privateActionsAllowed()
+        && request.getParameter("setPriority") != null) {
       Collection<JobInProgress> runningJobs = jobTracker.getRunningJobs();      
       JobPriority priority = JobPriority.valueOf(request.getParameter(
           "setPriority"));
@@ -134,7 +137,9 @@
         "Job Scheduler Administration</h1>\n", hostname);
     showPools(out, advancedView);
     showJobs(out, advancedView);
-    showAdminForm(out, advancedView);
+    if (JSPUtil.privateActionsAllowed()) {
+      showAdminForm(out, advancedView);
+    }
     out.print("</body></html>\n");
     out.close();
   }
@@ -221,17 +226,20 @@
             profile.getJobID(), profile.getJobID());
         out.printf("<td>%s</td>\n", profile.getUser());
         out.printf("<td>%s</td>\n", profile.getJobName());
-        out.printf("<td>%s</td>\n", generateSelect(
-            scheduler.getPoolManager().getPoolNames(),
-            scheduler.getPoolManager().getPoolName(job),
-            "/scheduler?setPool=<CHOICE>&jobid=" + profile.getJobID() +
-            (advancedView ? "&advanced" : "")));
-        out.printf("<td>%s</td>\n", generateSelect(
-            Arrays.asList(new String[]
-                {"VERY_LOW", "LOW", "NORMAL", "HIGH", "VERY_HIGH"}),
-            job.getPriority().toString(),
-            "/scheduler?setPriority=<CHOICE>&jobid=" + profile.getJobID() +
-            (advancedView ? "&advanced" : "")));
+        if (JSPUtil.privateActionsAllowed()) {
+          out.printf("<td>%s</td>\n", generateSelect(scheduler
+              .getPoolManager().getPoolNames(), scheduler.getPoolManager()
+              .getPoolName(job), "/scheduler?setPool=<CHOICE>&jobid="
+              + profile.getJobID() + (advancedView ? "&advanced" : "")));
+          out.printf("<td>%s</td>\n", generateSelect(Arrays
+              .asList(new String[] { "VERY_LOW", "LOW", "NORMAL", "HIGH",
+                  "VERY_HIGH" }), job.getPriority().toString(),
+              "/scheduler?setPriority=<CHOICE>&jobid=" + profile.getJobID()
+                  + (advancedView ? "&advanced" : "")));
+        } else {
+          out.printf("<td>%s</td>\n", scheduler.getPoolManager().getPoolName(job));
+          out.printf("<td>%s</td>\n", job.getPriority().toString());
+        }
         out.printf("<td>%d / %d</td><td>%d</td><td>%8.1f</td>\n",
             job.finishedMaps(), job.desiredMaps(), info.runningMaps,
             info.mapFairShare);

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JSPUtil.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JSPUtil.java?rev=764287&r1=764286&r2=764287&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JSPUtil.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JSPUtil.java Sun Apr 12 08:56:43
2009
@@ -45,8 +45,7 @@
   public static void processButtons(HttpServletRequest request,
       HttpServletResponse response, JobTracker tracker) throws IOException {
 
-    if (conf.getBoolean(PRIVATE_ACTIONS_KEY, false)
-        && request.getParameter("killJobs") != null) {
+    if (privateActionsAllowed() && request.getParameter("killJobs") != null) {
       String[] jobs = request.getParameterValues("jobCheckBox");
       if (jobs != null) {
         for (String job : jobs) {
@@ -55,8 +54,8 @@
       }
     }
 
-    if (conf.getBoolean(PRIVATE_ACTIONS_KEY, false) && 
-          request.getParameter("changeJobPriority") != null) {
+    if (privateActionsAllowed()
+        && request.getParameter("changeJobPriority") != null) {
       String[] jobs = request.getParameterValues("jobCheckBox");
 
       if (jobs != null) {
@@ -83,9 +82,7 @@
   public static String generateJobTable(String label, Collection<JobInProgress> jobs
       , int refresh, int rowId) throws IOException {
 
-    boolean isModifiable = label.equals("Running") 
-                                && conf.getBoolean(
-                                      PRIVATE_ACTIONS_KEY, false);
+    boolean isModifiable = label.equals("Running") && privateActionsAllowed();
     StringBuffer sb = new StringBuffer();
     
     sb.append("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n");
@@ -181,4 +178,7 @@
     return sb.toString();
   }
 
+  static final boolean privateActionsAllowed() {
+    return conf.getBoolean(PRIVATE_ACTIONS_KEY, false);
+  }
 }



Mime
View raw message