sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kathl...@apache.org
Subject git commit: SQOOP-986: Sqoop2: Add detection of local mode to mapreduce submission engine
Date Sun, 14 Apr 2013 23:09:26 GMT
Updated Branches:
  refs/heads/sqoop2 0a0a65a29 -> 75ae6e3ea


SQOOP-986: Sqoop2: Add detection of local mode to mapreduce submission engine

(Jarek Jarcec Cecho via Kate Ting)


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

Branch: refs/heads/sqoop2
Commit: 75ae6e3ea0931f7f677d3e0bfd5109c8fe85c369
Parents: 0a0a65a
Author: Kate Ting <kathleen@apache.org>
Authored: Sun Apr 14 19:08:34 2013 -0400
Committer: Kate Ting <kathleen@apache.org>
Committed: Sun Apr 14 19:08:34 2013 -0400

----------------------------------------------------------------------
 .../mapreduce/MapreduceSubmissionEngine.java       |   22 ++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/75ae6e3e/submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
----------------------------------------------------------------------
diff --git a/submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
b/submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
index 001fb02..dd7b9e7 100644
--- a/submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
+++ b/submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
@@ -114,6 +114,10 @@ public class MapreduceSubmissionEngine extends SubmissionEngine {
     } catch (IOException e) {
       throw new SqoopException(MapreduceSubmissionError.MAPREDUCE_0002, e);
     }
+
+    if(isLocal()) {
+      LOG.info("Detected MapReduce local mode, some methods might not work correctly.");
+    }
   }
 
   /**
@@ -249,7 +253,14 @@ public class MapreduceSubmissionEngine extends SubmissionEngine {
       job.setOutputKeyClass(request.getOutputKeyClass());
       job.setOutputValueClass(request.getOutputValueClass());
 
-      job.submit();
+      // If we're in local mode than wait on completion. Local job runner do not
+      // seems to be exposing API to get previously submitted job which makes
+      // other methods of the submission engine quite useless.
+      if(isLocal()) {
+        job.waitForCompletion(true);
+      } else {
+        job.submit();
+      }
 
       String jobId = job.getJobID().toString();
       request.getSummary().setExternalId(jobId);
@@ -400,4 +411,13 @@ public class MapreduceSubmissionEngine extends SubmissionEngine {
     return sqoopCounters;
   }
 
+  /**
+   * Detect MapReduce local mode.
+   *
+   * @return True if we're running in local mode
+   */
+  private boolean isLocal() {
+    return "local".equals(globalConfiguration.get("mapreduce.jobtracker.address"))
+        || "local".equals(globalConfiguration.get("mapred.job.tracker"));
+  }
 }


Mime
View raw message