[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hadoop-commits
Subject:    svn commit: r448356 - in /lucene/hadoop/trunk: ./
From:       cutting () apache ! org
Date:       2006-09-20 21:49:44
Message-ID: 20060920214944.859321A981A () eris ! apache ! org
[Download RAW message or body]

Author: cutting
Date: Wed Sep 20 14:49:43 2006
New Revision: 448356

URL: http://svn.apache.org/viewvc?view=rev&rev=448356
Log:
HADOOP-551.  Revert JobClient's console printout to only include a maximum of one \
update per percent of progress.  Contributed by Owen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/StringUtils.java
    lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp
    lucene/hadoop/trunk/src/webapps/job/jobtasks.jsp
    lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp
    lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Sep 20 14:49:43 2006
@@ -39,6 +39,10 @@
 11. HADOOP-293.  Report the full list of task error messages in the
     web ui, not just the most recent.  (omalley via cutting)
 
+12. HADOOP-551.  Restore JobClient's console printouts to only include
+    a maximum of one update per one percent of progress.
+    (omalley via cutting)
+
 
 Release 0.6.2 (unreleased)
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Wed Sep 20 \
14:49:43 2006 @@ -372,9 +372,9 @@
             }
             running = jc.getJob(jobId);
             String report = 
-              (" map " + StringUtils.formatPercent(running.mapProgress())+
+              (" map " + StringUtils.formatPercent(running.mapProgress(), 0)+
                " reduce " + 
-               StringUtils.formatPercent(running.reduceProgress()));
+               StringUtils.formatPercent(running.reduceProgress(), 0));
             if (!report.equals(lastReport)) {
               LOG.info(report);
               lastReport = report;

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/StringUtils.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/StringUtils.java?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/StringUtils.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/StringUtils.java Wed Sep 20 \
14:49:43 2006 @@ -83,11 +83,19 @@
     return oneDecimal.format(result) + suffix;
   }
   
-  private static DecimalFormat percentFormat = new DecimalFormat("0.00%");
-  
-  public static String formatPercent(double done) {
-    final int scale = 10000;
+  /**
+   * Format a percentage for presentation to the user.
+   * @param done the percentage to format (0.0 to 1.0)
+   * @param digits the number of digits past the decimal point
+   * @return a string representation of the percentage
+   */
+  public static String formatPercent(double done, int digits) {
+    DecimalFormat percentFormat = new DecimalFormat("0.00%");
+    double scale = Math.pow(10.0, digits+2);
     double rounded = Math.floor(done * scale);
+    percentFormat.setDecimalSeparatorAlwaysShown(false);
+    percentFormat.setMinimumFractionDigits(digits);
+    percentFormat.setMaximumFractionDigits(digits);
     return percentFormat.format(rounded / scale);
   }
   

Modified: lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobdetails.jsp Wed Sep 20 14:49:43 2006
@@ -10,7 +10,6 @@
 %>
 
 <%!
-  private static DecimalFormat percentFormat = new DecimalFormat("##0.00");
   JobTracker tracker = JobTracker.getTracker();
   String trackerName = 
            StringUtils.simpleHostname(tracker.getJobTrackerMachine());
@@ -36,7 +35,7 @@
     }
     out.print("<tr><th><a href=\"/jobtasks.jsp?jobid=" + jobId + 
               "&type="+ kind + "&pagenum=1\">" + kind + "</a></th><td>" + 
-              StringUtils.formatPercent(completePercent) +
+              StringUtils.formatPercent(completePercent, 2) +
               "</td><td>" + totalTasks + "</td><td>" + 
               (totalTasks - runningTasks - finishedTasks) + "</td><td>" +
               runningTasks + "</td><td>" +

Modified: lucene/hadoop/trunk/src/webapps/job/jobtasks.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobtasks.jsp?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobtasks.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobtasks.jsp Wed Sep 20 14:49:43 2006
@@ -63,7 +63,7 @@
           out.print("<tr><td><a href=\"taskdetails.jsp?jobid=" + jobid + 
                     "&taskid=" + report.getTaskId() + "\">"  + 
                     report.getTaskId() + "</a></td>");
-         out.print("<td>" + StringUtils.formatPercent(report.getProgress()) + 
+         out.print("<td>" + StringUtils.formatPercent(report.getProgress(),2) + 
                    "</td>");
          out.print("<td>"  + report.getState() + "</td>");
          String[] diagnostics = report.getDiagnostics();

Modified: lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp Wed Sep 20 14:49:43 2006
@@ -44,10 +44,10 @@
                   "<td>" + profile.getUser() + "</td>" 
                     + "<td>" + ("".equals(name) ? "&nbsp;" : name) + "</td>" + 
                     "<td>" + 
-                    StringUtils.formatPercent(status.mapProgress()) + 
+                    StringUtils.formatPercent(status.mapProgress(),2) + 
                     "</td><td>" + 
                     desiredMaps + "</td><td>" + completedMaps + "</td><td>" + 
-                    StringUtils.formatPercent(status.reduceProgress()) + 
+                    StringUtils.formatPercent(status.reduceProgress(),2) + 
                     "</td><td>" + 
                     desiredReduces + "</td><td> " + completedReduces + 
                     "</td></tr>\n");

Modified: lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp?view=diff&rev=448356&r1=448355&r2=448356
 ==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp Wed Sep 20 14:49:43 2006
@@ -66,7 +66,7 @@
       out.print("<td>");
       writeString(out, status.getRunState()); 
       out.print("</td>");
-      out.print("<td>"+ StringUtils.formatPercent(status.getProgress()) + 
+      out.print("<td>"+ StringUtils.formatPercent(status.getProgress(),2) + 
                 "</td>");
       out.print("<td><pre>");
       List<String> failures = tracker.getTaskDiagnostics(jobid, tipid,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic