crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject crunch git commit: CRUNCH-490: Use mapreduce.framework.name to determine whether MR is in local mode
Date Fri, 23 Jan 2015 20:55:51 GMT
Repository: crunch
Updated Branches:
  refs/heads/master 7f00d785a -> ab7e5e4c3


CRUNCH-490: Use mapreduce.framework.name to determine whether MR is in local mode


Project: http://git-wip-us.apache.org/repos/asf/crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/ab7e5e4c
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/ab7e5e4c
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/ab7e5e4c

Branch: refs/heads/master
Commit: ab7e5e4c3b1956d5ae6efe8706110e003179d6b6
Parents: 7f00d78
Author: Josh Wills <jwills@apache.org>
Authored: Thu Jan 22 23:12:27 2015 -0800
Committer: Josh Wills <jwills@apache.org>
Committed: Thu Jan 22 23:12:27 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/crunch/impl/mr/exec/MRExecutor.java  | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/ab7e5e4c/crunch-core/src/main/java/org/apache/crunch/impl/mr/exec/MRExecutor.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/impl/mr/exec/MRExecutor.java b/crunch-core/src/main/java/org/apache/crunch/impl/mr/exec/MRExecutor.java
index 63d0c5d..87546e1 100644
--- a/crunch-core/src/main/java/org/apache/crunch/impl/mr/exec/MRExecutor.java
+++ b/crunch-core/src/main/java/org/apache/crunch/impl/mr/exec/MRExecutor.java
@@ -257,10 +257,13 @@ public class MRExecutor extends AbstractFuture<PipelineResult>
implements MRPipe
 
   private static boolean isLocalMode() {
     Configuration conf = new Configuration();
-    // Try to handle MapReduce version 0.20 or 0.22
-    String jobTrackerAddress = conf.get("mapreduce.jobtracker.address",
-        conf.get("mapred.job.tracker", "local"));
-    return "local".equals(jobTrackerAddress);
+    String frameworkName = conf.get("mapreduce.framework.name", "");
+    if (frameworkName.isEmpty()) {
+      // Fallback to older jobtracker-based checks
+      frameworkName = conf.get("mapreduce.jobtracker.address",
+          conf.get("mapred.job.tracker", "local"));
+    }
+    return "local".equals(frameworkName);
   }
 
   @Override


Mime
View raw message