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 ac...@apache.org on 2011/03/17 21:21:54 UTC

svn commit: r1082677 [18/38] - in /hadoop/mapreduce/branches/MR-279: ./ assembly/ ivy/ mr-client/ mr-client/hadoop-mapreduce-client-app/ mr-client/hadoop-mapreduce-client-app/src/ mr-client/hadoop-mapreduce-client-app/src/main/ mr-client/hadoop-mapredu...

Modified: hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCacheOldApi.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCacheOldApi.java?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCacheOldApi.java (original)
+++ hadoop/mapreduce/branches/MR-279/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCacheOldApi.java Thu Mar 17 20:21:13 2011
@@ -46,7 +46,6 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.EmptyInputFormat;
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobConf;
-import org.apache.hadoop.mapred.JobTracker;
 import org.apache.hadoop.mapred.Mapper;
 import org.apache.hadoop.mapred.MiniMRCluster;
 import org.apache.hadoop.mapred.OutputCollector;
@@ -55,6 +54,7 @@ import org.apache.hadoop.mapred.Reducer;
 import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.mapred.lib.NullOutputFormat;
 import org.apache.hadoop.mapreduce.JobContext;
+import org.apache.hadoop.mapreduce.MRConfig;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.TokenIdentifier;
@@ -253,7 +253,7 @@ public class TestTokenCacheOldApi {
     URI nnUri = NameNode.getUri(nn.getNameNodeAddress());
     jConf.set(JobContext.JOB_NAMENODES, nnUri + "," + nnUri.toString());
     // job tracker principle id..
-    jConf.set(JobTracker.JT_USER_NAME, "jt_id");
+    jConf.set(MRConfig.MASTER_USER_NAME, "jt_id");
 
     // using argument to pass the file name
     String[] args = {

Modified: hadoop/mapreduce/branches/MR-279/src/test/unit/org/apache/hadoop/mapred/TestLostTaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/test/unit/org/apache/hadoop/mapred/TestLostTaskTracker.java?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/test/unit/org/apache/hadoop/mapred/TestLostTaskTracker.java (original)
+++ hadoop/mapreduce/branches/MR-279/src/test/unit/org/apache/hadoop/mapred/TestLostTaskTracker.java Thu Mar 17 20:21:13 2011
@@ -26,6 +26,7 @@ import junit.framework.TestCase;
 import org.apache.hadoop.mapred.UtilsForTests.FakeClock;
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
 import org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker;
+import org.apache.hadoop.mapreduce.util.HostUtil;
 import org.hamcrest.Matcher;
 import org.mockito.ArgumentCaptor;
 import org.mockito.ArgumentMatcher;
@@ -106,7 +107,7 @@ public class TestLostTaskTracker extends
 
   private void establishFirstContact(String tracker) throws IOException {
     TaskTrackerStatus status = new TaskTrackerStatus(tracker, 
-        JobInProgress.convertTrackerNameToHostName(tracker));
+        HostUtil.convertTrackerNameToHostName(tracker));
     jobTracker.heartbeat(status, false, true, false, (short) 0);
   }
   

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/analysejobhistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/analysejobhistory.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/analysejobhistory.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/analysejobhistory.jsp Thu Mar 17 20:21:13 2011
@@ -46,7 +46,7 @@
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
   JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker");
   JobHistoryParser.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request,
-      response, jobTracker, fs, new Path(logFile));
+  response, jobTracker, fs, new Path(logFile));
   if (job == null) {
     return;
   }
@@ -74,52 +74,52 @@
   Comparator<JobHistoryParser.TaskAttemptInfo> cMap = 
     new Comparator<JobHistoryParser.TaskAttemptInfo>() {
     public int compare(JobHistoryParser.TaskAttemptInfo t1, 
-        JobHistoryParser.TaskAttemptInfo t2) {
-      long l1 = t1.getFinishTime() - t1.getStartTime();
-      long l2 = t2.getFinishTime() - t2.getStartTime();
-      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    JobHistoryParser.TaskAttemptInfo t2) {
+  long l1 = t1.getFinishTime() - t1.getStartTime();
+  long l2 = t2.getFinishTime() - t2.getStartTime();
+  return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
   };
 
   Comparator<JobHistoryParser.TaskAttemptInfo> cShuffle = 
     new Comparator<JobHistoryParser.TaskAttemptInfo>() {
     public int compare(JobHistoryParser.TaskAttemptInfo t1, 
-        JobHistoryParser.TaskAttemptInfo t2) {
-      long l1 = t1.getShuffleFinishTime() - t1.getStartTime();
-      long l2 = t2.getShuffleFinishTime() - t2.getStartTime();
-      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    JobHistoryParser.TaskAttemptInfo t2) {
+  long l1 = t1.getShuffleFinishTime() - t1.getStartTime();
+  long l2 = t2.getShuffleFinishTime() - t2.getStartTime();
+  return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
   };
 
   Comparator<JobHistoryParser.TaskAttemptInfo> cFinishShuffle = 
     new Comparator<JobHistoryParser.TaskAttemptInfo>() {
     public int compare(JobHistoryParser.TaskAttemptInfo t1, 
-        JobHistoryParser.TaskAttemptInfo t2) {
-      long l1 = t1.getShuffleFinishTime(); 
-      long l2 = t2.getShuffleFinishTime();
-      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    JobHistoryParser.TaskAttemptInfo t2) {
+  long l1 = t1.getShuffleFinishTime(); 
+  long l2 = t2.getShuffleFinishTime();
+  return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
   };
 
   Comparator<JobHistoryParser.TaskAttemptInfo> cFinishMapRed = 
     new Comparator<JobHistoryParser.TaskAttemptInfo>() {
     public int compare(JobHistoryParser.TaskAttemptInfo t1, 
-        JobHistoryParser.TaskAttemptInfo t2) {
-      long l1 = t1.getFinishTime(); 
-      long l2 = t2.getFinishTime();
-      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    JobHistoryParser.TaskAttemptInfo t2) {
+  long l1 = t1.getFinishTime(); 
+  long l2 = t2.getFinishTime();
+  return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
   };
   
   Comparator<JobHistoryParser.TaskAttemptInfo> cReduce = 
     new Comparator<JobHistoryParser.TaskAttemptInfo>() {
     public int compare(JobHistoryParser.TaskAttemptInfo t1, 
-        JobHistoryParser.TaskAttemptInfo t2) {
-      long l1 = t1.getFinishTime() -
-                t1.getShuffleFinishTime();
-      long l2 = t2.getFinishTime() -
-                t2.getShuffleFinishTime();
-      return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
+    JobHistoryParser.TaskAttemptInfo t2) {
+  long l1 = t1.getFinishTime() -
+        t1.getShuffleFinishTime();
+  long l2 = t2.getFinishTime() -
+        t2.getShuffleFinishTime();
+  return (l2 < l1 ? -1 : (l2 == l1 ? 0 : 1));
     }
   }; 
 

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobblacklistedtrackers.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobblacklistedtrackers.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobblacklistedtrackers.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobblacklistedtrackers.jsp Thu Mar 17 20:21:13 2011
@@ -1,5 +1,4 @@
-<%
-/*
+<%/*
  * 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
@@ -15,8 +14,7 @@
  * 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.*"
@@ -33,12 +31,11 @@
 
 <%
   JobTracker tracker = (JobTracker) application.getAttribute(
-      "job.tracker");
+  "job.tracker");
   String trackerName = 
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
+   StringUtils.simpleHostname(tracker.getJobTrackerMachine());
 %>
-<%!       
-  private void printBlackListedTrackers(JspWriter out, 
+<%!private void printBlackListedTrackers(JspWriter out, 
                              JobInProgress job) throws IOException {
     Map<String, Integer> trackerErrors = job.getTaskTrackerErrors();
     out.print("<table border=2 cellpadding=\"5\" cellspacing=\"2\">");
@@ -51,26 +48,25 @@
       }
     }
     out.print("</table>\n");
-  }
-%>
+  }%>
 
 <%
-    String jobId = request.getParameter("jobid");
+  String jobId = request.getParameter("jobid");
     if (jobId == null) {
   	  out.println("<h2>Missing 'jobid' for fetching black-listed tasktrackers!</h2>");
   	  return;
     }
     
     JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker,
-        JobID.forName(jobId), request, response);
+    JobID.forName(jobId), request, response);
     if (!myJob.isViewJobAllowed()) {
-      return; // user is not authorized to view this job
+  return; // user is not authorized to view this job
     }
 
     JobInProgress job = myJob.getJob();
     if (job == null) {
-      out.print("<b>Job " + jobId + " not found.</b><br>\n");
-      return;
+  out.print("<b>Job " + jobId + " not found.</b><br>\n");
+  return;
     }
 %>
 

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf.jsp Thu Mar 17 20:21:13 2011
@@ -48,10 +48,9 @@
 <h2>Job Configuration: JobId - <%= jobId %></h2><br>
 
 <%
-
   final JobID jobIdObj = JobID.forName(jobId);
   JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker,
-      jobIdObj, request, response);
+  jobIdObj, request, response);
   if (!myJob.isViewJobAllowed()) {
     return; // user is not authorized to view this job
   }
@@ -61,8 +60,8 @@
   if (job == null) {
     String historyFile = tracker.getJobHistory().getHistoryFilePath(jobIdObj);
     if (historyFile == null) {
-      out.println("<h2>Job " + jobId + " not known!</h2>");
-      return;
+  out.println("<h2>Job " + jobId + " not known!</h2>");
+  return;
     }
     String historyUrl = "/jobconf_history.jsp?logFile=" + historyFile;
     response.sendRedirect(response.encodeRedirectURL(historyUrl));
@@ -75,16 +74,16 @@
     jobFile = new FileInputStream(jobFilePath);
     JobConf jobConf = new JobConf(jobFilePath);
     XMLUtils.transform(
-        jobConf.getConfResourceAsInputStream("webapps/static/jobconf.xsl"),
-        jobFile, out);
+    jobConf.getConfResourceAsInputStream("webapps/static/jobconf.xsl"),
+    jobFile, out);
   } catch (Exception e) {
     out.println("Failed to retreive job configuration for job '" + jobId + "!");
     out.println(e);
   } finally {
     if (jobFile != null) {
-      try { 
-        jobFile.close(); 
-      } catch (IOException e) {}
+  try { 
+    jobFile.close(); 
+  } catch (IOException e) {}
     }
   }
 %>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf_history.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf_history.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf_history.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobconf_history.jsp Thu Mar 17 20:21:13 2011
@@ -46,15 +46,14 @@
 
   Path logFile = new Path(logFileString);
   String jobId = JobHistory.getJobIDFromHistoryFilePath(logFile).toString();
-
 %>
   
 <html>
 
-<title>Job Configuration: JobId - <%= jobId %></title>
+<title>Job Configuration: JobId - <%=jobId%></title>
 
 <body>
-<h2>Job Configuration: JobId - <%= jobId %></h2><br>
+<h2>Job Configuration: JobId - <%=jobId%></h2><br>
 
 <%
   Path jobFilePath = JSPUtil.getJobConfFilePath(logFile);
@@ -66,24 +65,24 @@
     JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker");
 
     JobHistoryParser.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request,
-        response, jobTracker, fs, logFile);
+    response, jobTracker, fs, logFile);
     if (job == null) {
-      return;
+  return;
     }
 
     XMLUtils.transform(
-        jobConf.getConfResourceAsInputStream("webapps/static/jobconf.xsl"),
-        jobFile, out);
+    jobConf.getConfResourceAsInputStream("webapps/static/jobconf.xsl"),
+    jobFile, out);
   } catch (Exception e) {
     out.println("Failed to retreive job configuration for job '" + jobId + "!");
     out.println(e);
   } finally {
     if (jobFile != null) {
-      try { 
-        jobFile.close(); 
-      } catch (IOException e) {}
+  try { 
+    jobFile.close(); 
+  } catch (IOException e) {}
     }
-  } 
+  }
 %>
 
 <br>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetails.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetails.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetails.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetails.jsp Thu Mar 17 20:21:13 2011
@@ -44,12 +44,11 @@
 
 <%
   final JobTracker tracker = (JobTracker) application.getAttribute(
-      "job.tracker");
+  "job.tracker");
   String trackerName = 
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
+       StringUtils.simpleHostname(tracker.getJobTrackerMachine());
 %>
-<%!
-  private void printTaskSummary(JspWriter out,
+<%!private void printTaskSummary(JspWriter out,
                                 String jobId,
                                 String kind,
                                 double completePercent,
@@ -166,105 +165,102 @@
         + "</td><td width=\"100\"><form method=\"post\" action=\"" + url
         + "\"><input type=\"submit\" value=\"Cancel\" name=\"Cancel\""
         + "/></form></td></tr></table></body></html>");
-  }
-  
-%>       
-<%   
-    String jobId = request.getParameter("jobid"); 
-    String refreshParam = request.getParameter("refresh");
-    if (jobId == null) {
-      out.println("<h2>Missing 'jobid'!</h2>");
-      return;
-    }
-    
-    int refresh = 60; // refresh every 60 seconds by default
-    if (refreshParam != null) {
-        try {
-            refresh = Integer.parseInt(refreshParam);
-        }
-        catch (NumberFormatException ignored) {
-        }
-    }
-
-    final JobID jobIdObj = JobID.forName(jobId);
-    JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker, jobIdObj,
-                                                     request, response);
-    if (!myJob.isViewJobAllowed()) {
-      return; // user is not authorized to view this job
-    }
-
-    JobInProgress job = myJob.getJob();
-
-    final String newPriority = request.getParameter("prio");
-    String user = request.getRemoteUser();
-    UserGroupInformation ugi = null;
-    if (user != null) {
-      ugi = UserGroupInformation.createRemoteUser(user);
-    }
-    String action = request.getParameter("action");
-    if(JSPUtil.privateActionsAllowed(tracker.conf) && 
-        "changeprio".equalsIgnoreCase(action) 
-        && request.getMethod().equalsIgnoreCase("POST")) {
-      if (ugi != null) {
-        try {
-          ugi.doAs(new PrivilegedExceptionAction<Void>() {
-            public Void run() throws IOException{
-
-              // checks job modify permission
-              tracker.setJobPriority(jobIdObj, 
-                  JobPriority.valueOf(newPriority));
-              return null;
-            }
-          });
-        } catch(AccessControlException e) {
-          String errMsg = "User " + user + " failed to modify priority of " +
-              jobIdObj + "!<br><br>" + e.getMessage() +
-              "<hr><a href=\"jobdetails.jsp?jobid=" + jobId +
-              "\">Go back to Job</a><br>";
-          JSPUtil.setErrorAndForward(errMsg, request, response);
-          return;
-        }
-      }
-      else {// no authorization needed
-        tracker.setJobPriority(jobIdObj,
-             JobPriority.valueOf(newPriority));;
-      }
-    }
-    
-    if(JSPUtil.privateActionsAllowed(tracker.conf)) {
-      action = request.getParameter("action");
-      if(action!=null && action.equalsIgnoreCase("confirm")) {
-        printConfirm(out, jobId);
-        return;
-      }
-      else if(action != null && action.equalsIgnoreCase("kill") &&
-          request.getMethod().equalsIgnoreCase("POST")) {
-        if (ugi != null) {
-          try {
-            ugi.doAs(new PrivilegedExceptionAction<Void>() {
-              public Void run() throws IOException{
-
-                // checks job modify permission
-                tracker.killJob(jobIdObj);// checks job modify permission
-                return null;
-              }
-            });
-          } catch(AccessControlException e) {
-            String errMsg = "User " + user + " failed to kill " + jobIdObj +
-                "!<br><br>" + e.getMessage() +
-                "<hr><a href=\"jobdetails.jsp?jobid=" + jobId +
-                "\">Go back to Job</a><br>";
-            JSPUtil.setErrorAndForward(errMsg, request, response);
-            return;
-          }
-        }
-        else {// no authorization needed
-          tracker.killJob(jobIdObj);
-        }
-      }
-    }
-
-%>
+  }%>       
+<%
+         String jobId = request.getParameter("jobid"); 
+           String refreshParam = request.getParameter("refresh");
+           if (jobId == null) {
+         out.println("<h2>Missing 'jobid'!</h2>");
+         return;
+           }
+           
+           int refresh = 60; // refresh every 60 seconds by default
+           if (refreshParam != null) {
+           try {
+               refresh = Integer.parseInt(refreshParam);
+           }
+           catch (NumberFormatException ignored) {
+           }
+           }
+
+           final JobID jobIdObj = JobID.forName(jobId);
+           JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker, jobIdObj,
+                                                        request, response);
+           if (!myJob.isViewJobAllowed()) {
+         return; // user is not authorized to view this job
+           }
+
+           JobInProgress job = myJob.getJob();
+
+           final String newPriority = request.getParameter("prio");
+           String user = request.getRemoteUser();
+           UserGroupInformation ugi = null;
+           if (user != null) {
+         ugi = UserGroupInformation.createRemoteUser(user);
+           }
+           String action = request.getParameter("action");
+           if(JSPUtil.privateActionsAllowed(tracker.conf) && 
+           "changeprio".equalsIgnoreCase(action) 
+           && request.getMethod().equalsIgnoreCase("POST")) {
+         if (ugi != null) {
+           try {
+             ugi.doAs(new PrivilegedExceptionAction<Void>() {
+               public Void run() throws IOException{
+
+                 // checks job modify permission
+                 tracker.setJobPriority(jobIdObj, 
+                     JobPriority.valueOf(newPriority));
+                 return null;
+               }
+             });
+           } catch(AccessControlException e) {
+             String errMsg = "User " + user + " failed to modify priority of " +
+                 jobIdObj + "!<br><br>" + e.getMessage() +
+                 "<hr><a href=\"jobdetails.jsp?jobid=" + jobId +
+                 "\">Go back to Job</a><br>";
+             JSPUtil.setErrorAndForward(errMsg, request, response);
+             return;
+           }
+         }
+         else {// no authorization needed
+           tracker.setJobPriority(jobIdObj,
+                JobPriority.valueOf(newPriority));;
+         }
+           }
+           
+           if(JSPUtil.privateActionsAllowed(tracker.conf)) {
+         action = request.getParameter("action");
+         if(action!=null && action.equalsIgnoreCase("confirm")) {
+           printConfirm(out, jobId);
+           return;
+         }
+         else if(action != null && action.equalsIgnoreCase("kill") &&
+             request.getMethod().equalsIgnoreCase("POST")) {
+           if (ugi != null) {
+             try {
+               ugi.doAs(new PrivilegedExceptionAction<Void>() {
+                 public Void run() throws IOException{
+
+                   // checks job modify permission
+                   tracker.killJob(jobIdObj);// checks job modify permission
+                   return null;
+                 }
+               });
+             } catch(AccessControlException e) {
+               String errMsg = "User " + user + " failed to kill " + jobIdObj +
+                   "!<br><br>" + e.getMessage() +
+                   "<hr><a href=\"jobdetails.jsp?jobid=" + jobId +
+                   "\">Go back to Job</a><br>";
+               JSPUtil.setErrorAndForward(errMsg, request, response);
+               return;
+             }
+           }
+           else {// no authorization needed
+             tracker.killJob(jobIdObj);
+           }
+         }
+           }
+       %>
 
 <%@page import="org.apache.hadoop.mapred.TaskGraphServlet"%>
 <html>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetailshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetailshistory.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetailshistory.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobdetailshistory.jsp Thu Mar 17 20:21:13 2011
@@ -44,7 +44,7 @@
 
 <%! static SimpleDateFormat dateFormat = new SimpleDateFormat("d-MMM-yyyy HH:mm:ss") ; %>
 <%
-    String logFile = request.getParameter("logFile");
+  String logFile = request.getParameter("logFile");
     String reasonforFailure = " ";
     final Path jobFile = new Path(logFile);
     String jobid = JobHistory.getJobIDFromHistoryFilePath(jobFile).toString();
@@ -52,9 +52,9 @@
     final FileSystem fs = (FileSystem) application.getAttribute("fileSys");
     final JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker");
     JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request, response,
-        jobTracker, fs, jobFile);
+    jobTracker, fs, jobFile);
     if (job == null) {
-      return;
+  return;
     }
     // MR-1220 FIXME (LATER):  to fully integrate uberization, need task-
     // and attempt-level JobHistory/Avro/etc. changes to multiple Event
@@ -63,7 +63,7 @@
     int numUberSubMaps = job.getNumUberSubMaps();
     int numUberSubReduces = job.getNumUberSubReduces();
     if (job.getJobStatus().equals("FAILED")) 
-      reasonforFailure = job.getErrorInfo();
+  reasonforFailure = job.getErrorInfo();
 %>
 
 <html>
@@ -89,7 +89,7 @@
 <b>Status: </b> <%= ((job.getJobStatus()) == null ? "Incomplete" :job.getJobStatus()) %><br/> 
 <b>ReasonForFailure: </b> <%=reasonforFailure %><br/>
 <%
-    HistoryViewer.SummarizedJob sj = new HistoryViewer.SummarizedJob(job);
+  HistoryViewer.SummarizedJob sj = new HistoryViewer.SummarizedJob(job);
 %>
 <b><a href="analysejobhistory.jsp?logFile=<%=logFile%>">Analyse This Job</a></b> 
 <hr/>
@@ -108,25 +108,25 @@
         <%=sj.getNumFailedSetups()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=JOB_SETUP&status=KILLED">
         <%=sj.getNumKilledSetups()%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupStarted(), 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupFinished(), sj.getSetupStarted()) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupStarted(), 0)%></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getSetupFinished(), sj.getSetupStarted())%></td>
 </tr>
 <tr>
 
 <%
-    if (!isUber) {
+  if (!isUber) {
 %>
 <td>Map</td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=MAP&status=all">
         <%=sj.getTotalMaps()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=MAP&status=SUCCEEDED">
-        <%=job.getFinishedMaps() %></a></td>
+        <%=job.getFinishedMaps()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=MAP&status=FAILED">
         <%=sj.getNumFailedMaps()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=MAP&status=KILLED">
         <%=sj.getNumKilledMaps()%></a></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapStarted(), 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapFinished(), sj.getMapStarted()) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapStarted(), 0)%></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getMapFinished(), sj.getMapStarted())%></td>
 </tr>
 <tr>
 <td>Reduce</td>
@@ -138,12 +138,12 @@
         <%=sj.getNumFailedReduces()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=REDUCE&status=KILLED">
         <%=sj.getNumKilledReduces()%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceStarted(), 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceFinished(), sj.getReduceStarted()) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceStarted(), 0)%></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceFinished(), sj.getReduceStarted())%></td>
 </tr>
 
 <%
-    } else /* isUber */ {
+  } else /* isUber */ {
 %>
 
 <tr>
@@ -156,8 +156,8 @@
         <%=sj.getNumFailedReduces()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=REDUCE&status=KILLED">
         <%=sj.getNumKilledReduces()%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceStarted(), 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceFinished(), sj.getReduceStarted()) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceStarted(), 0)%></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getReduceFinished(), sj.getReduceStarted())%></td>
 </tr>
 <td>Map subtasks</td>
     <td colspan="6"><%=numUberSubMaps%></td>
@@ -168,7 +168,7 @@
 </tr>
 
 <%
-    }
+  }
 %>
 
 <tr>
@@ -181,8 +181,8 @@
         <%=sj.getNumFailedCleanups()%></a></td>
     <td><a href="jobtaskshistory.jsp?logFile=<%=logFile%>&taskType=JOB_CLEANUP&status=KILLED>">
         <%=sj.getNumKilledCleanups()%></a></td>  
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupStarted(), 0) %></td>
-    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupFinished(), sj.getCleanupStarted()) %></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupStarted(), 0)%></td>
+    <td><%=StringUtils.getFormattedTimeWithDiff(dateFormat, sj.getCleanupFinished(), sj.getCleanupStarted())%></td>
 </tr>
 </table>
 
@@ -198,9 +198,8 @@
   <th>Total</th>
 </tr>
 
-<%  
-
- Counters totalCounters = job.getTotalCounters();
+<%
+  Counters totalCounters = job.getTotalCounters();
  Counters mapCounters = job.getMapCounters();
  Counters reduceCounters = job.getReduceCounters();
 
@@ -215,24 +214,24 @@
      boolean isFirst = true;
      Iterator<Counter> ctrItr = totalGroup.iterator();
      while(ctrItr.hasNext()) {
-       Counter counter = ctrItr.next();
-       String name = counter.getName();
-       String mapValue = 
-        decimal.format(mapGroup.findCounter(name).getValue());
-       String reduceValue = 
-        decimal.format(reduceGroup.findCounter(name).getValue());
-       String totalValue = 
-        decimal.format(counter.getValue());
+   Counter counter = ctrItr.next();
+   String name = counter.getName();
+   String mapValue = 
+    decimal.format(mapGroup.findCounter(name).getValue());
+   String reduceValue = 
+    decimal.format(reduceGroup.findCounter(name).getValue());
+   String totalValue = 
+    decimal.format(counter.getValue());
 %>
        <tr>
 <%
-       if (isFirst) {
-         isFirst = false;
+  if (isFirst) {
+     isFirst = false;
 %>
          <td rowspan="<%=totalGroup.size()%>">
          <%=HtmlQuoting.quoteHtmlChars(totalGroup.getDisplayName())%></td>
 <%
-       }
+  }
 %>
        <td><%=HtmlQuoting.quoteHtmlChars(counter.getDisplayName())%></td>
        <td align="right"><%=mapValue%></td>
@@ -240,7 +239,7 @@
        <td align="right"><%=totalValue%></td>
      </tr>
 <%
-      }
+  }
     }
   }
 %>
@@ -249,49 +248,49 @@
 
 <br/>
  <%
-    HistoryViewer.FilteredJob filter = new HistoryViewer.FilteredJob(job,TaskStatus.State.FAILED.toString()); 
-    Map<String, Set<TaskID>> badNodes = filter.getFilteredMap(); 
-    if (badNodes.size() > 0) {
+   HistoryViewer.FilteredJob filter = new HistoryViewer.FilteredJob(job,TaskStatus.State.FAILED.toString()); 
+      Map<String, Set<TaskID>> badNodes = filter.getFilteredMap(); 
+      if (badNodes.size() > 0) {
  %>
 <h3>Failed tasks attempts by nodes </h3>
 <table border="1">
 <tr><td>Hostname</td><td>Failed Tasks</td></tr>
- <%	  
-      for (Map.Entry<String, Set<TaskID>> entry : badNodes.entrySet()) {
-        String node = entry.getKey();
-        Set<TaskID> failedTasks = entry.getValue();
-%>
+ <%
+   for (Map.Entry<String, Set<TaskID>> entry : badNodes.entrySet()) {
+      String node = entry.getKey();
+      Set<TaskID> failedTasks = entry.getValue();
+ %>
         <tr>
-        <td><%=node %></td>
+        <td><%=node%></td>
         <td>
 <%
-          boolean firstId = true;
-          for (TaskID tid : failedTasks) {
-             if (firstId) {
-              firstId = false;
+  boolean firstId = true;
+  for (TaskID tid : failedTasks) {
+     if (firstId) {
+      firstId = false;
 %>
-            <a href="taskdetailshistory.jsp?logFile=<%=logFile%>&tipid=<%=tid %>"><%=tid %></a>
-<%		  
-          } else {
+            <a href="taskdetailshistory.jsp?logFile=<%=logFile%>&tipid=<%=tid%>"><%=tid%></a>
+<%
+  } else {
 %>	
-            ,&nbsp<a href="taskdetailshistory.jsp?logFile=<%=logFile%>&tipid=<%=tid %>"><%=tid %></a>
-<%		  
-          }
-        }
+            ,&nbsp<a href="taskdetailshistory.jsp?logFile=<%=logFile%>&tipid=<%=tid%>"><%=tid%></a>
+<%
+  }
+    }
 %>	
         </td>
         </tr>
-<%	  
-      }
+<%
+  }
 	}
- %>
+%>
 </table>
 <br/>
 
  <%
-    filter = new HistoryViewer.FilteredJob(job, TaskStatus.State.KILLED.toString());
-    badNodes = filter.getFilteredMap(); 
-    if (badNodes.size() > 0) {
+   filter = new HistoryViewer.FilteredJob(job, TaskStatus.State.KILLED.toString());
+      badNodes = filter.getFilteredMap(); 
+      if (badNodes.size() > 0) {
  %>
 <h3>Killed tasks attempts by nodes </h3>
 <table border="1">

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobfailures.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobfailures.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobfailures.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobfailures.jsp Thu Mar 17 20:21:13 2011
@@ -1,5 +1,4 @@
-<%
-/*
+<%/*
  * 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
@@ -15,8 +14,7 @@
  * 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.*"
@@ -28,6 +26,7 @@
   import="org.apache.hadoop.mapred.JSPUtil.JobWithViewAccessCheck"
   import="org.apache.hadoop.mapreduce.TaskType"
   import="org.apache.hadoop.util.*"
+  import="org.apache.hadoop.mapreduce.util.*"
 %>
 
 <%!	private static final long serialVersionUID = 1L;
@@ -36,10 +35,9 @@
 <%
   JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
   String trackerName = 
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
+       StringUtils.simpleHostname(tracker.getJobTrackerMachine());
 %>
-<%! 
-  private void printFailedAttempts(JspWriter out,
+<%!private void printFailedAttempts(JspWriter out,
                                    JobTracker tracker,
                                    TaskInProgress tip,
                                    TaskStatus.State failState) throws IOException {
@@ -80,7 +78,7 @@
         out.print("<td>");
         String taskLogUrl = null;
         if (taskTracker != null) {
-          taskLogUrl = TaskLogServlet.getTaskLogUrl(taskTracker.getHost(),
+          taskLogUrl = HostUtil.getTaskLogUrl(taskTracker.getHost(),
                                 String.valueOf(taskTracker.getHttpPort()),
                                 statuses[i].getTaskID().toString());
         }
@@ -157,27 +155,26 @@
       }
     }
     out.print("</table>\n");
-  }
-%>
+  }%>
 
 <%
-    String jobId = request.getParameter("jobid");
+  String jobId = request.getParameter("jobid");
     if (jobId == null) {
-      out.println("<h2>Missing 'jobid'!</h2>");
-      return;
+  out.println("<h2>Missing 'jobid'!</h2>");
+  return;
     }
     JobID jobIdObj = JobID.forName(jobId);
     
     JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(
-        tracker, jobIdObj, request, response);
+    tracker, jobIdObj, request, response);
     if (!myJob.isViewJobAllowed()) {
-      return; // user is not authorized to view this job
+  return; // user is not authorized to view this job
     }
 
     JobInProgress job = myJob.getJob();
     if (job == null) {
-      out.print("<b>Job " + jobId + " not found.</b><br>\n");
-      return;
+  out.print("<b>Job " + jobId + " not found.</b><br>\n");
+  return;
     }
 
     String kind = request.getParameter("kind");

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobhistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobhistory.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobhistory.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobhistory.jsp Thu Mar 17 20:21:13 2011
@@ -1,5 +1,4 @@
-<%
-/*
+<%/*
  * 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
@@ -15,8 +14,7 @@
  * 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="java.io.*"
@@ -36,23 +34,20 @@
   import="org.apache.hadoop.mapreduce.jobhistory.JobHistory.JobHistoryRecordRetriever"
 %>
 
-<%!	private static final long serialVersionUID = 1L;
-%>
+<%!private static final long serialVersionUID = 1L;%>
 
-<%	
+<%
   JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
   String trackerName =
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
-%>
-<%!	
-  private static SimpleDateFormat dateFormat = 
-                                    new SimpleDateFormat("d/MM HH:mm:ss");
+   StringUtils.simpleHostname(tracker.getJobTrackerMachine());
 %>
+<%!private static SimpleDateFormat dateFormat = 
+                                    new SimpleDateFormat("d/MM HH:mm:ss");%>
 <html>
 <head>
 <script type="text/JavaScript">
 <!--
-<% // assuming search is already quoted %>
+<%// assuming search is already quoted%>
 function showUserHistory(search)
 {
 var url
@@ -66,18 +61,18 @@ window.location.href = url;
 //-->
 </script>
 <link rel="stylesheet" type="text/css" href="/static/hadoop.css">
-<title><%= trackerName %> Hadoop Map/Reduce History Viewer</title>
+<title><%=trackerName%> Hadoop Map/Reduce History Viewer</title>
 <link rel="stylesheet" type="text/css" href="/static/hadoop.css">
 </head>
 <body>
-<h1> <a href="jobtracker.jsp"><%= trackerName %></a> Hadoop Map/Reduce 
+<h1> <a href="jobtracker.jsp"><%=trackerName%></a> Hadoop Map/Reduce 
      <a href="jobhistory.jsp">History Viewer</a></h1>
 <hr>
 <%
   //{{ // this is here to make indentation work, and must be commented out
     final String search = (request.getParameter("search") == null)
-                          ? ""
-                          : request.getParameter("search");
+                      ? ""
+                      : request.getParameter("search");
 
     String soughtDate = "";
     String soughtJobName = "";
@@ -90,31 +85,31 @@ window.location.href = url;
     final String DATE_PATTERN = "([0-1]?[0-9])/([0-3]?[0-9])/((?:2[0-9])?[0-9][0-9])";
 
     if (splitDate.length >= 2) {
-      soughtDate = splitDate[1];
+  soughtDate = splitDate[1];
     }
 
     String[] splitJobName = splitDate[0].split(";");
 
     if (splitJobName.length >= 2) {
-      soughtJobName = splitJobName[1];
+  soughtJobName = splitJobName[1];
     }
 
     String[] splitJobid = splitJobName[0].split(":");
 
     if (splitJobid.length >= 2) {
-      soughtJobid = splitJobid[1];
+  soughtJobid = splitJobid[1];
     }
 
     final String soughtUser = (splitJobid.length >= 1)
-                        ? splitJobid[0].toLowerCase()
-                        : "";
+                    ? splitJobid[0].toLowerCase()
+                    : "";
 
     if (soughtDate.length() != 0) {
-      Pattern p = Pattern.compile(DATE_PATTERN);
-      Matcher m = p.matcher(soughtDate);
-      if (!m.matches()) {
-        soughtDate = "";
-      }
+  Pattern p = Pattern.compile(DATE_PATTERN);
+  Matcher m = p.matcher(soughtDate);
+  if (!m.matches()) {
+    soughtDate = "";
+  }
     }
 
     JobHistory jobHistory = (JobHistory) application.getAttribute("jobHistoryHistory");
@@ -122,54 +117,54 @@ window.location.href = url;
     soughtDates[0] = soughtDate;
 
     JobHistoryRecordRetriever retriever
-      = jobHistory.getMatchingJobs
-           (soughtUser, soughtJobName, soughtDates, soughtJobid);
+  = jobHistory.getMatchingJobs
+       (soughtUser, soughtJobName, soughtDates, soughtJobid);
     
     JobHistoryJobRecord[] records
-      = new JobHistoryJobRecord[retriever.numberMatches()];
+  = new JobHistoryJobRecord[retriever.numberMatches()];
 
     int recordsIndex = 0;
 
     while (retriever.hasNext()) {
-      records[recordsIndex++] = retriever.next();
+  records[recordsIndex++] = retriever.next();
     }
     
     out.println("<!--  user : " + soughtUser + ", jobid : " + soughtJobid + "-->");
     if (records.length == 0)  {
-      out.println("No files found!"); 
-      return ; 
+  out.println("No files found!"); 
+  return ; 
     }
 
     // get the pageno
     int pageno = request.getParameter("pageno") == null
-                ? 1
-                : Integer.parseInt(request.getParameter("pageno"));
+            ? 1
+            : Integer.parseInt(request.getParameter("pageno"));
 
     // get the total number of files to display
     int size = 100;
 
     // if show-all is requested or jobfiles < size(100)
     if (pageno == -1 || size > records.length) {
-      size = records.length;
+  size = records.length;
     }
 
     if (pageno == -1) { // special case 'show all'
-      pageno = 1;
+  pageno = 1;
     }
 
     int maxPageNo = (records.length + size - 1) / size;
 
     // check and fix pageno
     if (pageno < 1 || pageno > maxPageNo) {
-      out.println("Invalid page index");
-      return ;
+  out.println("Invalid page index");
+  return ;
     }
 
     int length = size ; // determine the length of job history files to be displayed
     if (pageno == maxPageNo) {
-      // find the number of files to be shown on the last page
-      int startOnLast = ((pageno - 1) * size) + 1;
-      length = records.length - startOnLast + 1;
+  // find the number of files to be shown on the last page
+  int startOnLast = ((pageno - 1) * size) + 1;
+  length = records.length - startOnLast + 1;
     }
 
     // Display the search box
@@ -190,13 +185,13 @@ window.location.href = url;
     // display the number of jobs, start index, end index
     out.println("(<i> <span class=\"small\">Displaying <b>" + length + "</b> jobs from <b>" + start + "</b> to <b>" + (start + length - 1) + "</b> out of <b>" + records.length + "</b> jobs");
     if (!"".equals(soughtUser)) {
-      out.println(" for user <b>" + soughtUser + "</b>"); // show the user if present
+  out.println(" for user <b>" + soughtUser + "</b>"); // show the user if present
     }
     if (!"".equals(soughtJobid)) {
-      out.println(" for jobid <b>" + soughtJobid + "</b> in it "); // show the jobid keyword if present
+  out.println(" for jobid <b>" + soughtJobid + "</b> in it "); // show the jobid keyword if present
     }
     if (!"".equals(soughtDate)) {
-      out.println(" for date <b>" + soughtDate + "</b>"); // show the jobid keyword if present
+  out.println(" for date <b>" + soughtDate + "</b>"); // show the jobid keyword if present
     }
     out.print("</span></i>)");
 
@@ -205,39 +200,39 @@ window.location.href = url;
 
     // show the 'first-page' link
     if (pageno > 1) {
-      out.println(" [<span class=\"small\"><a href=\"jobhistory.jsp?pageno=1&search=" + search + "\">first page</a></span>]");
+  out.println(" [<span class=\"small\"><a href=\"jobhistory.jsp?pageno=1&search=" + search + "\">first page</a></span>]");
     } else {
-      out.println("[<span class=\"small\">first page]</span>");
+  out.println("[<span class=\"small\">first page]</span>");
     }
 
     // show the 'last-page' link
     if (pageno < maxPageNo) {
-      out.println(" [<span class=\"small\"><a href=\"jobhistory.jsp?pageno=" + maxPageNo + "&search=" + search + "\">last page</a></span>]");
+  out.println(" [<span class=\"small\"><a href=\"jobhistory.jsp?pageno=" + maxPageNo + "&search=" + search + "\">last page</a></span>]");
     } else {
-      out.println("<span class=\"small\">[last page]</span>");
+  out.println("<span class=\"small\">[last page]</span>");
     }
 
     // REVERSE sort the files on creation time.
     Arrays.sort(records, new Comparator<JobHistoryJobRecord>() {
-                  public int compare(JobHistoryJobRecord rec1, JobHistoryJobRecord rec2) {
-                    String id1 = rec1.getJobIDString(true);
-                    String id2 = rec2.getJobIDString(true);
-
-                    String[] idsplit1 = id1.split("_");
-                    String[] idsplit2 = id2.split("_");
-        
-                    // compare job tracker start time
-                    Long jtTime2 = Long.parseLong(idsplit2[1]);
-                    // comparison sense is reversed
-                    int res = jtTime2.compareTo(Long.parseLong(idsplit1[1]));
-                    if (res == 0) {
-                      // comparison sense is reversed
-                      Long sn2 = Long.parseLong(idsplit2[2]);
-                      res = sn2.compareTo(Long.parseLong(idsplit1[2]));
-                    }
-                    return res;
-                  }
-                });
+              public int compare(JobHistoryJobRecord rec1, JobHistoryJobRecord rec2) {
+                String id1 = rec1.getJobIDString(true);
+                String id2 = rec2.getJobIDString(true);
+
+                String[] idsplit1 = id1.split("_");
+                String[] idsplit2 = id2.split("_");
+    
+                // compare job tracker start time
+                Long jtTime2 = Long.parseLong(idsplit2[1]);
+                // comparison sense is reversed
+                int res = jtTime2.compareTo(Long.parseLong(idsplit1[1]));
+                if (res == 0) {
+                  // comparison sense is reversed
+                  Long sn2 = Long.parseLong(idsplit2[2]);
+                  res = sn2.compareTo(Long.parseLong(idsplit1[2]));
+                }
+                return res;
+              }
+            });
 
     out.println("<br><br>");
 
@@ -254,22 +249,21 @@ window.location.href = url;
     
     Set<String> displayedJobs = new HashSet<String>();
     for (int i = start - 1; i < start + length - 1; ++i) {
-      JobHistoryJobRecord record = records[i];
+  JobHistoryJobRecord record = records[i];
 
-      String jobId = record.getJobIDString();
-      String userName = record.getUserName();
-      long submitTime = record.getSubmitTime();
-      String jobName = record.getJobName();
-      Path logPath = record.getPath();
-
-      // Check if the job is already displayed. There can be multiple job 
-      // history files for jobs that have restarted
-      if (displayedJobs.contains(jobId)) {
-        continue;
-      } else {
-        displayedJobs.add(jobId);
-      }
-      
+  String jobId = record.getJobIDString();
+  String userName = record.getUserName();
+  long submitTime = record.getSubmitTime();
+  String jobName = record.getJobName();
+  Path logPath = record.getPath();
+
+  // Check if the job is already displayed. There can be multiple job 
+  // history files for jobs that have restarted
+  if (displayedJobs.contains(jobId)) {
+    continue;
+  } else {
+    displayedJobs.add(jobId);
+  }
 %>
 <center>
 <%	
@@ -283,8 +277,7 @@ window.location.href = url;
     // show the navigation info (bottom)
     printNavigation(pageno, size, maxPageNo, search, out);
 %>
-<%!
-    private void printJob(long timestamp, String jobId, 
+<%!private void printJob(long timestamp, String jobId, 
                           String user, Path logFile, String jobName, JspWriter out)
     throws IOException {
       out.print("<tr>"); 
@@ -358,6 +351,5 @@ window.location.href = url;
         out.println("<a href=\"jobhistory.jsp?pageno=" + (pageno + 1) + "&search=" + search + "\">Next</a>");
       }
       out.print("></center>");
-    }
-%> 
+    }%> 
 </body></html>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobqueue_details.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobqueue_details.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobqueue_details.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobqueue_details.jsp Thu Mar 17 20:21:13 2011
@@ -30,7 +30,7 @@
 <%
   JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
   String trackerName = StringUtils.simpleHostname(tracker
-      .getJobTrackerMachine());
+  .getJobTrackerMachine());
   String queueName = request.getParameter("queueName");
   TaskScheduler scheduler = tracker.getTaskScheduler();
   JobQueueInfo schedInfo = tracker.getQueueInfo(queueName);

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtable.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtable.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtable.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtable.jsp Thu Mar 17 20:21:13 2011
@@ -30,7 +30,7 @@ import="org.apache.hadoop.util.ServletUt
 private static final long serialVersionUID = 1L;
 %>
 <%
-JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+  JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
 QueueManager qmgr = tracker.getQueueManager();
 String queue = request.getParameter("queue_name");
 TaskScheduler scheduler = tracker.getTaskScheduler();
@@ -44,7 +44,7 @@ if(queueInfo == null || (queueInfo.getCh
 } else {
 %>
 <%
-Collection<JobInProgress> jobs = scheduler.getJobs(queue);
+  Collection<JobInProgress> jobs = scheduler.getJobs(queue);
 String[] queueLabelSplits = queue.split(":");
 String queueLabel = 
   queueLabelSplits.length==0?queue:queueLabelSplits[queueLabelSplits.length-1];

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtasks.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtasks.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtasks.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtasks.jsp Thu Mar 17 20:21:13 2011
@@ -36,7 +36,7 @@
 <%
   JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
   String trackerName = 
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
+   StringUtils.simpleHostname(tracker.getJobTrackerMachine());
   String jobid = request.getParameter("jobid");
   if (jobid == null) {
     out.println("<h2>Missing 'jobid'!</h2>");
@@ -45,7 +45,7 @@
   JobID jobidObj = JobID.forName(jobid);
 
   JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker, jobidObj,
-      request, response);
+  request, response);
   if (!myJob.isViewJobAllowed()) {
     return; // user is not authorized to view this job
   }

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtaskshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtaskshistory.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtaskshistory.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtaskshistory.jsp Thu Mar 17 20:21:13 2011
@@ -39,7 +39,7 @@
 <%!	private static final long serialVersionUID = 1L;
 %>
 
-<%	
+<%
   String logFile = request.getParameter("logFile");
   String taskStatus = request.getParameter("status"); 
   String taskType = request.getParameter("taskType"); 
@@ -47,11 +47,11 @@
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
   JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker");
   JobHistoryParser.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request,
-      response, jobTracker, fs, new Path(logFile));
+  response, jobTracker, fs, new Path(logFile));
   if (job == null) {
     return;
   }
-  Map<TaskID, JobHistoryParser.TaskInfo> tasks = job.getAllTasks(); 
+  Map<TaskID, JobHistoryParser.TaskInfo> tasks = job.getAllTasks();
 %>
 <html>
 <body>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jsp Thu Mar 17 20:21:13 2011
@@ -1,5 +1,4 @@
-<%
-/*
+<%/*
  * 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
@@ -15,8 +14,7 @@
  * 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.*"
@@ -40,14 +38,13 @@
   MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
   ClusterMetrics metrics = tracker.getClusterMetrics();
   String trackerName = 
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
+   StringUtils.simpleHostname(tracker.getJobTrackerMachine());
   JobQueueInfo[] queues = tracker.getJobQueues();
   List<JobInProgress> runningJobs = tracker.getRunningJobs();
   List<JobInProgress> completedJobs = tracker.getCompletedJobs();
   List<JobInProgress> failedJobs = tracker.getFailedJobs();
 %>
-<%!
-  private static DecimalFormat percentFormat = new DecimalFormat("##0.00");
+<%!private static DecimalFormat percentFormat = new DecimalFormat("##0.00");
   
   public void generateSummaryTable(JspWriter out, ClusterMetrics metrics,
                                    JobTracker tracker) throws IOException {
@@ -124,7 +121,6 @@
   </ul>
 </div>
 
-<b>State:</b> <%= status.getJobTrackerState() %><br>
 <b>Started:</b> <%= new Date(tracker.getStartTime())%><br>
 <b>Version:</b> <%= VersionInfo.getVersion()%>,
                 <%= VersionInfo.getRevision()%><br>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jspx
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jspx?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jspx (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/jobtracker.jspx Thu Mar 17 20:21:13 2011
@@ -49,7 +49,6 @@
     <tracker_name><jsp:expression>trackerName</jsp:expression></tracker_name>
 
     <tracker>
-      <state><jsp:expression>tracker.getClusterStatus().getJobTrackerState()</jsp:expression></state>
       <started><jsp:expression>new Date(tracker.getStartTime())</jsp:expression></started>
       <version><jsp:expression>VersionInfo.getVersion()</jsp:expression></version>
       <revision><jsp:expression>VersionInfo.getRevision()</jsp:expression></revision>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/machines.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/machines.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/machines.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/machines.jsp Thu Mar 17 20:21:13 2011
@@ -35,8 +35,7 @@
            StringUtils.simpleHostname(tracker.getJobTrackerMachine());
   String type = request.getParameter("type");
 %>
-<%!
-  public void generateTaskTrackerTable(JspWriter out,
+<%!public void generateTaskTrackerTable(JspWriter out,
                                        String type,
                                        JobTracker tracker) throws IOException {
     Collection c;
@@ -162,8 +161,7 @@
       out.print("</table>\n");
       out.print("</center>\n");
     }
-  }
-%>
+  }%>
 
 <html>
 

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/queuetable.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/queuetable.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/queuetable.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/queuetable.jsp Thu Mar 17 20:21:13 2011
@@ -36,7 +36,7 @@ private static final long serialVersionU
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <%
-JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+  JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
 JobQueueInfo[] queues = tracker.getRootJobQueues();
 %>
 <title>Queue Information</title>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetails.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetails.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetails.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetails.jsp Thu Mar 17 20:21:13 2011
@@ -32,6 +32,7 @@
   import="org.apache.hadoop.security.UserGroupInformation"
   import="java.security.PrivilegedExceptionAction"
   import="org.apache.hadoop.security.AccessControlException"
+  import="org.apache.hadoop.mapreduce.util.*"
 %>
 <%!static SimpleDateFormat dateFormat = new SimpleDateFormat(
       "d-MMM-yyyy HH:mm:ss");
@@ -54,122 +55,122 @@
         + "/></form></td></tr></table></body></html>");
   }%>
 <%
-    final JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
+  final JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
 
     String attemptid = request.getParameter("attemptid");
     final TaskAttemptID attemptidObj = TaskAttemptID.forName(attemptid);
 
     // Obtain tipid for attemptid, if attemptid is available.
     TaskID tipidObj =
-        (attemptidObj == null) ? TaskID.forName(request.getParameter("tipid"))
-                               : attemptidObj.getTaskID();
+    (attemptidObj == null) ? TaskID.forName(request.getParameter("tipid"))
+                           : attemptidObj.getTaskID();
     if (tipidObj == null) {
-      out.print("<b>tipid sent is not valid.</b><br>\n");
-      return;
+  out.print("<b>tipid sent is not valid.</b><br>\n");
+  return;
     }
     // Obtain jobid from tipid
     final JobID jobidObj = tipidObj.getJobID();
     String jobid = jobidObj.toString();
 
     JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker, jobidObj,
-        request, response);
+    request, response);
     if (!myJob.isViewJobAllowed()) {
-      return; // user is not authorized to view this job
+  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) {
-      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;
+  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);
     if (privateActions) {
-      String action = request.getParameter("action");
-      if (action != null) {
-        String user = request.getRemoteUser();
-        UserGroupInformation ugi = null;
-        if (user != null) {
-          ugi = UserGroupInformation.createRemoteUser(user);
-        }
-        if (action.equalsIgnoreCase("confirm")) {
-          String subAction = request.getParameter("subaction");
-          if (subAction == null)
-            subAction = "fail-task";
-          printConfirm(out, attemptid, subAction);
+  String action = request.getParameter("action");
+  if (action != null) {
+    String user = request.getRemoteUser();
+    UserGroupInformation ugi = null;
+    if (user != null) {
+      ugi = UserGroupInformation.createRemoteUser(user);
+    }
+    if (action.equalsIgnoreCase("confirm")) {
+      String subAction = request.getParameter("subaction");
+      if (subAction == null)
+        subAction = "fail-task";
+      printConfirm(out, attemptid, subAction);
+      return;
+    }
+    else if (action.equalsIgnoreCase("kill-task") 
+        && request.getMethod().equalsIgnoreCase("POST")) {
+      if (ugi != null) {
+        try {
+          ugi.doAs(new PrivilegedExceptionAction<Void>() {
+          public Void run() throws IOException{
+
+            tracker.killTask(attemptidObj, false);// checks job modify permission
+            return null;
+          }
+          });
+        } catch(AccessControlException e) {
+          String errMsg = "User " + user + " failed to kill task "
+              + attemptidObj + "!<br><br>" + e.getMessage() +
+              "<hr><a href=\"jobdetails.jsp?jobid=" + jobid +
+              "\">Go back to Job</a><br>";
+          JSPUtil.setErrorAndForward(errMsg, request, response);
           return;
         }
-        else if (action.equalsIgnoreCase("kill-task") 
-            && request.getMethod().equalsIgnoreCase("POST")) {
-          if (ugi != null) {
-            try {
-              ugi.doAs(new PrivilegedExceptionAction<Void>() {
-              public Void run() throws IOException{
-
-                tracker.killTask(attemptidObj, false);// checks job modify permission
-                return null;
-              }
-              });
-            } catch(AccessControlException e) {
-              String errMsg = "User " + user + " failed to kill task "
-                  + attemptidObj + "!<br><br>" + e.getMessage() +
-                  "<hr><a href=\"jobdetails.jsp?jobid=" + jobid +
-                  "\">Go back to Job</a><br>";
-              JSPUtil.setErrorAndForward(errMsg, request, response);
-              return;
-            }
-          } else {// no authorization needed
-            tracker.killTask(attemptidObj, false);
-          }
+      } else {// no authorization needed
+        tracker.killTask(attemptidObj, false);
+      }
 
-          //redirect again so that refreshing the page will not attempt to rekill the task
-          response.sendRedirect("/taskdetails.jsp?subaction=kill-task" +
-              "&tipid=" + tipidObj.toString());
-        }
-        else if (action.equalsIgnoreCase("fail-task")
-            && request.getMethod().equalsIgnoreCase("POST")) {
-          if (ugi != null) {
-            try {
-              ugi.doAs(new PrivilegedExceptionAction<Void>() {
-              public Void run() throws IOException{
-
-                tracker.killTask(attemptidObj, true);// checks job modify permission
-                return null;
-              }
-              });
-            } catch(AccessControlException e) {
-              String errMsg = "User " + user + " failed to fail task "
-                  + attemptidObj + "!<br><br>" + e.getMessage() +
-                  "<hr><a href=\"jobdetails.jsp?jobid=" + jobid +
-                  "\">Go back to Job</a><br>";
-              JSPUtil.setErrorAndForward(errMsg, request, response);
-              return;
-            }
-          } else {// no authorization needed
-            tracker.killTask(attemptidObj, true);
-          }
+      //redirect again so that refreshing the page will not attempt to rekill the task
+      response.sendRedirect("/taskdetails.jsp?subaction=kill-task" +
+          "&tipid=" + tipidObj.toString());
+    }
+    else if (action.equalsIgnoreCase("fail-task")
+        && request.getMethod().equalsIgnoreCase("POST")) {
+      if (ugi != null) {
+        try {
+          ugi.doAs(new PrivilegedExceptionAction<Void>() {
+          public Void run() throws IOException{
 
-          response.sendRedirect("/taskdetails.jsp?subaction=fail-task" +
-              "&tipid=" + tipidObj.toString());
+            tracker.killTask(attemptidObj, true);// checks job modify permission
+            return null;
+          }
+          });
+        } catch(AccessControlException e) {
+          String errMsg = "User " + user + " failed to fail task "
+              + attemptidObj + "!<br><br>" + e.getMessage() +
+              "<hr><a href=\"jobdetails.jsp?jobid=" + jobid +
+              "\">Go back to Job</a><br>";
+          JSPUtil.setErrorAndForward(errMsg, request, response);
+          return;
         }
+      } else {// no authorization needed
+        tracker.killTask(attemptidObj, true);
       }
+
+      response.sendRedirect("/taskdetails.jsp?subaction=fail-task" +
+          "&tipid=" + tipidObj.toString());
+    }
+  }
     }
     TaskInProgress tip = job.getTaskInProgress(tipidObj);
     TaskStatus[] ts = null;
     boolean isCleanupOrSetup = false;
     if (tip != null) { 
-      ts = tip.getTaskStatuses();
-      isCleanupOrSetup = tip.isJobCleanupTask();
-      if (!isCleanupOrSetup) {
-        isCleanupOrSetup = tip.isJobSetupTask();
-      }
+  ts = tip.getTaskStatuses();
+  isCleanupOrSetup = tip.isJobCleanupTask();
+  if (!isCleanupOrSetup) {
+    isCleanupOrSetup = tip.isJobSetupTask();
+  }
     }
 %>
 
@@ -220,129 +221,129 @@
       String cleanupAttemptTracker = null;
       boolean hasCleanupAttempt = false;
       if (tip != null && tip.isCleanupAttempt(status.getTaskID())) {
-        cleanupTrackerName = tip.machineWhereCleanupRan(status.getTaskID());
-        cleanupTracker = tracker.getTaskTrackerStatus(cleanupTrackerName);
-        if (cleanupTracker != null) {
-          cleanupAttemptTracker = "http://" + cleanupTracker.getHost() + ":"
-            + cleanupTracker.getHttpPort();
-        }
-        hasCleanupAttempt = true;
+    cleanupTrackerName = tip.machineWhereCleanupRan(status.getTaskID());
+    cleanupTracker = tracker.getTaskTrackerStatus(cleanupTrackerName);
+    if (cleanupTracker != null) {
+      cleanupAttemptTracker = "http://" + cleanupTracker.getHost() + ":"
+        + cleanupTracker.getHttpPort();
+    }
+    hasCleanupAttempt = true;
       }
       out.print("<td>");
       if (hasCleanupAttempt) {
-        out.print("Task attempt: ");
+    out.print("Task attempt: ");
       }
       if (taskTracker == null) {
-        out.print(taskTrackerName);
+    out.print(taskTrackerName);
       } else {
-        taskAttemptTracker = "http://" + taskTracker.getHost() + ":"
-          + taskTracker.getHttpPort();
-        out.print("<a href=\"" + taskAttemptTracker + "\">"
-          + tracker.getNode(taskTracker.getHost()) + "</a>");
+    taskAttemptTracker = "http://" + taskTracker.getHost() + ":"
+      + taskTracker.getHttpPort();
+    out.print("<a href=\"" + taskAttemptTracker + "\">"
+      + tracker.getNode(taskTracker.getHost()) + "</a>");
       }
       if (hasCleanupAttempt) {
-        out.print("<br/>Cleanup Attempt: ");
-        if (cleanupAttemptTracker == null ) {
-          out.print(cleanupTrackerName);
-        } else {
-          out.print("<a href=\"" + cleanupAttemptTracker + "\">"
-            + tracker.getNode(cleanupTracker.getHost()) + "</a>");
-        }
+    out.print("<br/>Cleanup Attempt: ");
+    if (cleanupAttemptTracker == null ) {
+      out.print(cleanupTrackerName);
+    } else {
+      out.print("<a href=\"" + cleanupAttemptTracker + "\">"
+        + tracker.getNode(cleanupTracker.getHost()) + "</a>");
+    }
       }
       out.print("</td>");
-        out.print("<td>" + status.getRunState() + "</td>");
-        out.print("<td>" + StringUtils.formatPercent(status.getProgress(), 2)
-          + ServletUtil.percentageGraph(status.getProgress() * 100f, 80) + "</td>");
-        out.print("<td>"
-          + StringUtils.getFormattedTimeWithDiff(dateFormat, status
-          .getStartTime(), 0) + "</td>");
-        if (ts[i].getIsMap()) {
-          out.print("<td>"
-          + StringUtils.getFormattedTimeWithDiff(dateFormat, status
-          .getMapFinishTime(), status.getStartTime()) + "</td>");
-        }
-        else if (!isCleanupOrSetup) {
-          out.print("<td>"
-          + StringUtils.getFormattedTimeWithDiff(dateFormat, status
-          .getShuffleFinishTime(), status.getStartTime()) + "</td>");
-        out.println("<td>"
-          + StringUtils.getFormattedTimeWithDiff(dateFormat, status
-          .getSortFinishTime(), status.getShuffleFinishTime())
-          + "</td>");
-        }
-        out.println("<td>"
-          + StringUtils.getFormattedTimeWithDiff(dateFormat, status
-          .getFinishTime(), status.getStartTime()) + "</td>");
-
-        out.print("<td><pre>");
-        String [] failures = tracker.getTaskDiagnostics(status.getTaskID());
-        if (failures == null) {
-          out.print("&nbsp;");
-        } else {
-          for(int j = 0 ; j < failures.length ; j++){
-            out.print(HtmlQuoting.quoteHtmlChars(failures[j]));
-            if (j < (failures.length - 1)) {
-              out.print("\n-------\n");
-            }
-          }
+    out.print("<td>" + status.getRunState() + "</td>");
+    out.print("<td>" + StringUtils.formatPercent(status.getProgress(), 2)
+      + ServletUtil.percentageGraph(status.getProgress() * 100f, 80) + "</td>");
+    out.print("<td>"
+      + StringUtils.getFormattedTimeWithDiff(dateFormat, status
+      .getStartTime(), 0) + "</td>");
+    if (ts[i].getIsMap()) {
+      out.print("<td>"
+      + StringUtils.getFormattedTimeWithDiff(dateFormat, status
+      .getMapFinishTime(), status.getStartTime()) + "</td>");
+    }
+    else if (!isCleanupOrSetup) {
+      out.print("<td>"
+      + StringUtils.getFormattedTimeWithDiff(dateFormat, status
+      .getShuffleFinishTime(), status.getStartTime()) + "</td>");
+    out.println("<td>"
+      + StringUtils.getFormattedTimeWithDiff(dateFormat, status
+      .getSortFinishTime(), status.getShuffleFinishTime())
+      + "</td>");
+    }
+    out.println("<td>"
+      + StringUtils.getFormattedTimeWithDiff(dateFormat, status
+      .getFinishTime(), status.getStartTime()) + "</td>");
+
+    out.print("<td><pre>");
+    String [] failures = tracker.getTaskDiagnostics(status.getTaskID());
+    if (failures == null) {
+      out.print("&nbsp;");
+    } else {
+      for(int j = 0 ; j < failures.length ; j++){
+        out.print(HtmlQuoting.quoteHtmlChars(failures[j]));
+        if (j < (failures.length - 1)) {
+          out.print("\n-------\n");
         }
-        out.print("</pre></td>");
-        out.print("<td>");
-        String taskLogUrl = null;
-        if (taskTracker != null ) {
-        	taskLogUrl = TaskLogServlet.getTaskLogUrl(taskTracker.getHost(),
-        						String.valueOf(taskTracker.getHttpPort()),
-        						status.getTaskID().toString());
+      }
+    }
+    out.print("</pre></td>");
+    out.print("<td>");
+    String taskLogUrl = null;
+    if (taskTracker != null ) {
+    	taskLogUrl = HostUtil.getTaskLogUrl(taskTracker.getHost(),
+    						String.valueOf(taskTracker.getHttpPort()),
+    						status.getTaskID().toString());
       	}
-        if (hasCleanupAttempt) {
-          out.print("Task attempt: <br/>");
-        }
-        if (taskLogUrl == null) {
-          out.print("n/a");
-        } else {
-          String tailFourKBUrl = taskLogUrl + "&start=-4097";
-          String tailEightKBUrl = taskLogUrl + "&start=-8193";
-          String entireLogUrl = taskLogUrl + "&all=true";
-          out.print("<a href=\"" + tailFourKBUrl + "\">Last 4KB</a><br/>");
-          out.print("<a href=\"" + tailEightKBUrl + "\">Last 8KB</a><br/>");
-          out.print("<a href=\"" + entireLogUrl + "\">All</a><br/>");
-        }
-        if (hasCleanupAttempt) {
-          out.print("Cleanup attempt: <br/>");
-          taskLogUrl = null;
-          if (cleanupTracker != null ) {
-        	taskLogUrl = TaskLogServlet.getTaskLogUrl(cleanupTracker.getHost(),
-                                String.valueOf(cleanupTracker.getHttpPort()),
-                                status.getTaskID().toString());
+    if (hasCleanupAttempt) {
+      out.print("Task attempt: <br/>");
+    }
+    if (taskLogUrl == null) {
+      out.print("n/a");
+    } else {
+      String tailFourKBUrl = taskLogUrl + "&start=-4097";
+      String tailEightKBUrl = taskLogUrl + "&start=-8193";
+      String entireLogUrl = taskLogUrl + "&all=true";
+      out.print("<a href=\"" + tailFourKBUrl + "\">Last 4KB</a><br/>");
+      out.print("<a href=\"" + tailEightKBUrl + "\">Last 8KB</a><br/>");
+      out.print("<a href=\"" + entireLogUrl + "\">All</a><br/>");
+    }
+    if (hasCleanupAttempt) {
+      out.print("Cleanup attempt: <br/>");
+      taskLogUrl = null;
+      if (cleanupTracker != null ) {
+    	taskLogUrl = HostUtil.getTaskLogUrl(cleanupTracker.getHost(),
+                            String.valueOf(cleanupTracker.getHttpPort()),
+                            status.getTaskID().toString());
       	  }
-          if (taskLogUrl == null) {
-            out.print("n/a");
-          } else {
-            String tailFourKBUrl = taskLogUrl + "&start=-4097&cleanup=true";
-            String tailEightKBUrl = taskLogUrl + "&start=-8193&cleanup=true";
-            String entireLogUrl = taskLogUrl + "&all=true&cleanup=true";
-            out.print("<a href=\"" + tailFourKBUrl + "\">Last 4KB</a><br/>");
-            out.print("<a href=\"" + tailEightKBUrl + "\">Last 8KB</a><br/>");
-            out.print("<a href=\"" + entireLogUrl + "\">All</a><br/>");
-          }
-        }
-        out.print("</td><td>" + "<a href=\"/taskstats.jsp?attemptid=" +
-          status.getTaskID() + "\">"
-          + ((status.getCounters() != null) ? status.getCounters().size() : 0)
-          + "</a></td>");
-        out.print("<td>");
-        if (privateActions
-          && status.getRunState() == TaskStatus.State.RUNNING) {
-        out.print("<a href=\"/taskdetails.jsp?action=confirm"
-          + "&subaction=kill-task" + "&attemptid=" + status.getTaskID()
-          + "\" > Kill </a>");
-        out.print("<br><a href=\"/taskdetails.jsp?action=confirm"
-          + "&subaction=fail-task" + "&attemptid=" + status.getTaskID()
-          + "\" > Fail </a>");
-        }
-        else
-          out.print("<pre>&nbsp;</pre>");
-        out.println("</td></tr>");
+      if (taskLogUrl == null) {
+        out.print("n/a");
+      } else {
+        String tailFourKBUrl = taskLogUrl + "&start=-4097&cleanup=true";
+        String tailEightKBUrl = taskLogUrl + "&start=-8193&cleanup=true";
+        String entireLogUrl = taskLogUrl + "&all=true&cleanup=true";
+        out.print("<a href=\"" + tailFourKBUrl + "\">Last 4KB</a><br/>");
+        out.print("<a href=\"" + tailEightKBUrl + "\">Last 8KB</a><br/>");
+        out.print("<a href=\"" + entireLogUrl + "\">All</a><br/>");
+      }
+    }
+    out.print("</td><td>" + "<a href=\"/taskstats.jsp?attemptid=" +
+      status.getTaskID() + "\">"
+      + ((status.getCounters() != null) ? status.getCounters().size() : 0)
+      + "</a></td>");
+    out.print("<td>");
+    if (privateActions
+      && status.getRunState() == TaskStatus.State.RUNNING) {
+    out.print("<a href=\"/taskdetails.jsp?action=confirm"
+      + "&subaction=kill-task" + "&attemptid=" + status.getTaskID()
+      + "\" > Kill </a>");
+    out.print("<br><a href=\"/taskdetails.jsp?action=confirm"
+      + "&subaction=fail-task" + "&attemptid=" + status.getTaskID()
+      + "\" > Fail </a>");
+    }
+    else
+      out.print("<pre>&nbsp;</pre>");
+    out.println("</td></tr>");
       }
   %>
 </table>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetailshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetailshistory.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetailshistory.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/taskdetailshistory.jsp Thu Mar 17 20:21:13 2011
@@ -38,13 +38,13 @@
 <%!	private static final long serialVersionUID = 1L;
 %>
 
-<%	
+<%
   String logFile = request.getParameter("logFile");
   String tipid = request.getParameter("tipid"); 
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
   JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker");
   JobHistoryParser.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request,
-      response, jobTracker, fs, new Path(logFile));
+  response, jobTracker, fs, new Path(logFile));
   if (job == null) {
     return;
   }
@@ -89,8 +89,7 @@
 <%
   }
 %>
-<%!
-  private void printTaskAttempt(JobHistoryParser.TaskAttemptInfo taskAttempt,
+<%!private void printTaskAttempt(JobHistoryParser.TaskAttemptInfo taskAttempt,
                                 TaskType type, JspWriter out, String logFile) 
   throws IOException {
     out.print("<tr>"); 
@@ -138,7 +137,6 @@
       out.print("<td></td>");
     }
     out.print("</tr>"); 
-  }
-%>
+  }%>
 </body>
 </html>

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstats.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstats.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstats.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstats.jsp Thu Mar 17 20:21:13 2011
@@ -36,20 +36,20 @@
 <%
   JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
   String trackerName = 
-           StringUtils.simpleHostname(tracker.getJobTrackerMachine());
+   StringUtils.simpleHostname(tracker.getJobTrackerMachine());
 
   String attemptid = request.getParameter("attemptid");
   TaskAttemptID attemptidObj = TaskAttemptID.forName(attemptid);
   // Obtain tipid for attemptId, if attemptId is available.
   TaskID tipidObj =
-      (attemptidObj == null) ? TaskID.forName(request.getParameter("tipid"))
-                             : attemptidObj.getTaskID();
+  (attemptidObj == null) ? TaskID.forName(request.getParameter("tipid"))
+                     : attemptidObj.getTaskID();
   // Obtain jobid from tipid
   JobID jobidObj = tipidObj.getJobID();
   String jobid = jobidObj.toString();
   
   JobWithViewAccessCheck myJob = JSPUtil.checkAccessAndGetJob(tracker, jobidObj,
-      request, response);
+  request, response);
   if (!myJob.isViewJobAllowed()) {
     return; // user is not authorized to view this job
   }
@@ -60,11 +60,11 @@
     JobID jobIdObj = JobID.forName(jobid);
     String historyFile = tracker.getJobHistory().getHistoryFilePath(jobIdObj);
     if (historyFile == null) {
-      out.println("<h2>Job " + jobid + " not known!</h2>");
-      return;
+  out.println("<h2>Job " + jobid + " not known!</h2>");
+  return;
     }
     String historyUrl = "/taskstatshistory.jsp?logFile=" + historyFile +
-                        "&attemptid=" + attemptid;
+                "&attemptid=" + attemptid;
     response.sendRedirect(response.encodeRedirectURL(historyUrl));
     return;
   }

Modified: hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstatshistory.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstatshistory.jsp?rev=1082677&r1=1082676&r2=1082677&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstatshistory.jsp (original)
+++ hadoop/mapreduce/branches/MR-279/src/webapps/job/taskstatshistory.jsp Thu Mar 17 20:21:13 2011
@@ -52,7 +52,7 @@
   FileSystem fs = (FileSystem) application.getAttribute("fileSys");
   JobTracker jobTracker = (JobTracker) application.getAttribute("job.tracker");
   JobHistoryParser.JobInfo job = JSPUtil.checkAccessAndGetJobInfo(request,
-      response, jobTracker, fs, new Path(logFile));
+  response, jobTracker, fs, new Path(logFile));
   if (job == null) {
     return;
   }

Added: hadoop/mapreduce/branches/MR-279/yarn/README
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/README?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/README (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/README Thu Mar 17 20:21:13 2011
@@ -0,0 +1,92 @@
+YARN (YET ANOTHER RESOURCE NEGOTIATOR or YARN Application Resource Negotiator)
+------------------------------------------------------------------------------
+
+Requirements
+-------------
+Java: JDK 1.6
+Maven: Maven 2
+
+Setup
+-----
+Install the Avro maven plugin in local maven repository:
+mvn install:install-file -Dfile=./avro-maven-plugin/avro-maven-plugin-1.4.0-SNAPSHOT.jar -DpomFile=./avro-maven-plugin/avro-maven-plugin-1.4.0-SNAPSHOT.pom
+
+Quick Maven Tips
+----------------
+clean workspace: mvn clean
+compile and test: mvn install
+skip tests: mvn install -DskipTests
+skip test execution but compile: mvn install -Dmaven.test.skip.exec=true
+skip native build: mvn -fn install -P-cbuild
+clean and test: mvn clean install
+run selected test after compile: mvn test -Dtest=TestClassName (combined: mvn clean install -Dtest=TestClassName)
+create runnable binaries after install: mvn assembly:assembly (combined: mvn clean install assembly:assembly)
+
+
+Eclipse Projects
+----------------
+http://maven.apache.org/guides/mini/guide-ide-eclipse.html
+
+1. Generate .project and .classpath files in all maven modules
+mvn eclipse:eclipse
+CAUTION: If the project structure has changed from your previous workspace, clean up all .project and .classpath files recursively. Then run:
+mvn eclipse:eclipse
+
+2. Import the projects in eclipse.
+
+3. Set the environment variable M2_REPO to point to your .m2/repository location.
+
+NetBeans Projects
+-----------------
+
+NetBeans has builtin support of maven projects. Just "Open Project..."
+and everything is setup automatically. Verified with NetBeans 6.9.1.
+
+
+Custom Hadoop Dependencies
+--------------------------
+
+By default Hadoop dependencies are specified in the top-level pom.xml
+properties section. One can override them via -Dhadoop-common.version=...
+on the command line. ~/.m2/settings.xml can also be used to specify
+these properties in different profiles, which is useful for IDEs.
+
+Modules
+-------
+YARN consists of multiple modules. The modules are listed below as per the directory structure:
+
+yarn-api - Yarn's cross platform external interface
+
+yarn-common - Utilities which can be used by yarn clients and server
+
+yarn-server - Implementation of the yarn-api
+	yarn-server-common - APIs shared between resourcemanager and nodemanager
+	yarn-server-nodemanager
+	yarn-server-resourcemanager
+
+yarn-prototype - AppMaster (Prototype) to launch TTs via nodemanager
+
+yarn-mapreduce - Mapreduce specific parts
+	yarn-mapreduce-common - Mapreduce utilities and interfae shared between client and mapreduce AppMaster
+	yarn-mapreduce-client - Mapreduce client (uses JobClient)
+	yarn-mapreduce-app - Mapreduce AppMaster
+
+yarn-master-worker - master-worker AppMaster
+
+General instructions for starting Yarn and MapReduce
+----------------------------------------------------
+At yarn project root,
+
+	mvn clean install
+
+ResourceManager:
+	cd yarn-server/yarn-server-resourcemanager
+	mvn exec:java -Dexec.mainClass=org.apache.hadoop.yarn.server.resourcemanager.ResourceManager
+
+NodeManager:
+	cd yarn-server/yarn-server-nodemanager
+	mvn exec:java -Dexec.mainClass=org.apache.hadoop.yarn.server.nodemanager.NodeManager
+
+MRAppMaster
+	cd yarn-mapreduce/yarn-mapreduce-app
+	mvn exec:java -Dexec.mainClass=org.apache.hadoop.yarn.mapreduce.app.MRAppMaster -Dexec.args="<clusterts> <appid>"

Added: hadoop/mapreduce/branches/MR-279/yarn/bin/slaves.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/slaves.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/slaves.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/slaves.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Run a shell command on all slave hosts.
+#
+# Environment Variables
+#
+#   YARN_SLAVES    File naming remote hosts.
+#     Default is ${YARN_CONF_DIR}/slaves.
+#   YARN_CONF_DIR  Alternate conf dir. Default is ${YARN_HOME}/conf.
+#   YARN_SLAVE_SLEEP Seconds to sleep between spawning remote commands.
+#   YARN_SSH_OPTS Options passed to ssh when running remote commands.
+##
+
+usage="Usage: slaves.sh [--config confdir] command..."
+
+# if no args specified, show usage
+if [ $# -le 0 ]; then
+  echo $usage
+  exit 1
+fi
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/yarn-config.sh
+
+# If the slaves file is specified in the command line,
+# then it takes precedence over the definition in 
+# yarn-env.sh. Save it here.
+HOSTLIST=$YARN_SLAVES
+
+if [ -f "${YARN_CONF_DIR}/yarn-env.sh" ]; then
+  . "${YARN_CONF_DIR}/yarn-env.sh"
+fi
+
+if [ "$HOSTLIST" = "" ]; then
+  if [ "$YARN_SLAVES" = "" ]; then
+    export HOSTLIST="${YARN_CONF_DIR}/slaves"
+  else
+    export HOSTLIST="${YARN_SLAVES}"
+  fi
+fi
+
+for slave in `cat "$HOSTLIST"|sed  "s/#.*$//;/^$/d"`; do
+ ssh $YARN_SSH_OPTS $slave $"${@// /\\ }" \
+   2>&1 | sed "s/^/$slave: /" &
+ if [ "$YARN_SLAVE_SLEEP" != "" ]; then
+   sleep $YARN_SLAVE_SLEEP
+ fi
+done
+
+wait

Added: hadoop/mapreduce/branches/MR-279/yarn/bin/start-all.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/start-all.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/start-all.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/start-all.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Start all yarn daemons.  Run this on master node.
+
+echo "starting yarn daemons"
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/yarn-config.sh
+# start resourceManager
+"$bin"/yarn-daemon.sh --config $YARN_CONF_DIR  start resourcemanager
+# start nodeManager
+"$bin"/yarn-daemons.sh --config $YARN_CONF_DIR  start nodemanager

Added: hadoop/mapreduce/branches/MR-279/yarn/bin/stop-all.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/stop-all.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/stop-all.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/stop-all.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Stop all yarn daemons.  Run this on master node.
+
+echo "stopping yarn daemons"
+
+bin=`dirname "${BASH_SOURCE-$0}"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/yarn-config.sh
+# stop resourceManager
+"$bin"/yarn-daemon.sh --config $YARN_CONF_DIR  stop resourcemanager
+# stop nodeManager
+"$bin"/yarn-daemons.sh --config $YARN_CONF_DIR  stop nodemanager