You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ch...@apache.org on 2013/11/03 03:14:30 UTC

svn commit: r1538308 - in /pig/branches/tez/src/org/apache/pig/tools/pigstats: PigStats.java mapreduce/MRPigStatsUtil.java

Author: cheolsoo
Date: Sun Nov  3 02:14:29 2013
New Revision: 1538308

URL: http://svn.apache.org/r1538308
Log:
PIG-3556: Fix tez branch compilation with Hadoop 1.0

Modified:
    pig/branches/tez/src/org/apache/pig/tools/pigstats/PigStats.java
    pig/branches/tez/src/org/apache/pig/tools/pigstats/mapreduce/MRPigStatsUtil.java

Modified: pig/branches/tez/src/org/apache/pig/tools/pigstats/PigStats.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/tools/pigstats/PigStats.java?rev=1538308&r1=1538307&r2=1538308&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/tools/pigstats/PigStats.java (original)
+++ pig/branches/tez/src/org/apache/pig/tools/pigstats/PigStats.java Sun Nov  3 02:14:29 2013
@@ -30,7 +30,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapred.JobClient;
-import org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob;
 import org.apache.pig.PigException;
 import org.apache.pig.PigRunner.ReturnCode;
 import org.apache.pig.classification.InterfaceAudience;
@@ -469,7 +468,7 @@ public abstract class PigStats {
         }
     }
 
-    public void setBackendException(ControlledJob job, Exception e) {
+    public void setBackendException(String jobId, Exception e) {
         if (e instanceof PigException) {
             LOG.error("ERROR " + ((PigException)e).getErrorCode() + ": "
                     + e.getLocalizedMessage());
@@ -477,15 +476,14 @@ public abstract class PigStats {
             LOG.error("ERROR: " + e.getLocalizedMessage());
         }
 
-        if (job.getJobID() == null || e == null) {
+        if (jobId == null || e == null) {
             LOG.debug("unable to set backend exception");
             return;
         }
-        String id = job.getJobID().toString();
         Iterator<JobStats> iter = jobPlan.iterator();
         while (iter.hasNext()) {
             JobStats js = iter.next();
-            if (id.equals(js.getJobId())) {
+            if (jobId.equals(js.getJobId())) {
                 js.setBackendException(e);
                 break;
             }

Modified: pig/branches/tez/src/org/apache/pig/tools/pigstats/mapreduce/MRPigStatsUtil.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/tools/pigstats/mapreduce/MRPigStatsUtil.java?rev=1538308&r1=1538307&r2=1538308&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/tools/pigstats/mapreduce/MRPigStatsUtil.java (original)
+++ pig/branches/tez/src/org/apache/pig/tools/pigstats/mapreduce/MRPigStatsUtil.java Sun Nov  3 02:14:29 2013
@@ -27,6 +27,7 @@ import org.apache.hadoop.mapred.JobClien
 import org.apache.hadoop.mapred.RunningJob;
 import org.apache.hadoop.mapred.jobcontrol.Job;
 import org.apache.hadoop.mapred.jobcontrol.JobControl;
+import org.apache.hadoop.mapreduce.JobID;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceOper;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.NativeMapReduceOper;
@@ -253,7 +254,11 @@ public class MRPigStatsUtil extends PigS
     
     
     public static void setBackendException(Job job, Exception e) {
-        ((SimplePigStats)PigStats.get()).setBackendException(job, e);
+        JobID jobId = job.getAssignedJobID();
+        if (jobId == null) {
+            return;
+        }
+        PigStats.get().setBackendException(jobId.toString(), e);
     }
     
     private static MRJobStats addFailedJobStats(SimplePigStats ps, Job job) {