hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r783940 - /hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecDriver.java
Date Thu, 11 Jun 2009 22:05:47 GMT
Author: namit
Date: Thu Jun 11 22:05:46 2009
New Revision: 783940

URL: http://svn.apache.org/viewvc?rev=783940&view=rev
Log:
HIVE-547. Better logging in ExecDriver
(Zheng Shao via namit)


Modified:
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecDriver.java

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecDriver.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecDriver.java?rev=783940&r1=783939&r2=783940&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecDriver.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecDriver.java Thu Jun 11
22:05:46 2009
@@ -19,7 +19,6 @@
 package org.apache.hadoop.hive.ql.exec;
 
 import java.io.*;
-import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.net.URI;
@@ -187,31 +186,34 @@
     String lastReport = "";
     SimpleDateFormat dateFormat
         = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss,SSS");
+    long reportTime = System.currentTimeMillis();
+    long maxReportInterval = 60 * 1000; // One minute
     while (!rj.isComplete()) {
       try {
         Thread.sleep(1000);
       } catch (InterruptedException e) {
       }
       rj = jc.getJob(rj.getJobID());
-      String report = null;
-      report = dateFormat.format(Calendar.getInstance().getTime())
-          + " map = " + Math.round(rj.mapProgress() * 100) + "%,  reduce ="
+      String report = " map = " + Math.round(rj.mapProgress() * 100) + "%,  reduce ="
           + Math.round(rj.reduceProgress() * 100) + "%";
 
-      if (!report.equals(lastReport)) {
+      if (!report.equals(lastReport)
+          || System.currentTimeMillis() >= reportTime + maxReportInterval) {
 
+        String output = dateFormat.format(Calendar.getInstance().getTime()) + report;
         SessionState ss = SessionState.get();
         if (ss != null) {
           ss.getHiveHistory().setTaskCounters(
               SessionState.get().getQueryId(), getId(), rj);
           ss.getHiveHistory().setTaskProperty(
               SessionState.get().getQueryId(), getId(),
-              Keys.TASK_HADOOP_PROGRESS, report);
+              Keys.TASK_HADOOP_PROGRESS, output);
           ss.getHiveHistory().progressTask(
               SessionState.get().getQueryId(), this);
         }
-        console.printInfo(report);
+        console.printInfo(output);
         lastReport = report;
+        reportTime = System.currentTimeMillis();
       }
     }
     return rj;



Mime
View raw message