accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject git commit: ACCUMULO-1874 removed usage of Job.getInstance, moved job instance creation to a utility class for examples
Date Sun, 10 Nov 2013 16:26:01 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 433ad0203 -> d868e30d7


ACCUMULO-1874 removed usage of Job.getInstance, moved job instance creation to a utility class
for examples


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: d868e30d7bc60b3478272bbdd395a45a5ba05a69
Parents: 433ad02
Author: Billie Rinaldi <billie.rinaldi@gmail.com>
Authored: Sun Nov 10 08:18:28 2013 -0800
Committer: Billie Rinaldi <billie.rinaldi@gmail.com>
Committed: Sun Nov 10 08:18:28 2013 -0800

----------------------------------------------------------------------
 .../simple/filedata/CharacterHistogram.java     |  5 ++--
 .../examples/simple/mapreduce/JobUtil.java      | 28 ++++++++++++++++++++
 .../examples/simple/mapreduce/NGramIngest.java  |  4 +--
 .../examples/simple/mapreduce/RegexExample.java |  4 +--
 .../examples/simple/mapreduce/RowHash.java      |  4 +--
 .../examples/simple/mapreduce/TableToFile.java  |  4 +--
 .../simple/mapreduce/TeraSortIngest.java        |  4 +--
 .../simple/mapreduce/TokenFileWordCount.java    |  2 +-
 .../simple/mapreduce/UniqueColumns.java         |  4 +--
 .../examples/simple/mapreduce/WordCount.java    |  4 +--
 .../mapreduce/bulk/BulkIngestExample.java       |  5 ++--
 .../simple/filedata/ChunkInputFormatTest.java   |  5 ++--
 12 files changed, 52 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/CharacterHistogram.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/CharacterHistogram.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/CharacterHistogram.java
index c7b9e07..11eda3e 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/CharacterHistogram.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/CharacterHistogram.java
@@ -30,6 +30,7 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.user.SummingArrayCombiner;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.examples.simple.mapreduce.JobUtil;
 import org.apache.hadoop.conf.Configured;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapreduce.Job;
@@ -82,8 +83,8 @@ public class CharacterHistogram extends Configured implements Tool {
   
   @Override
   public int run(String[] args) throws Exception {
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), this.getClass().getSimpleName());
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(this.getClass().getSimpleName());
     job.setJarByClass(this.getClass());
 
     Opts opts = new Opts();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/JobUtil.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/JobUtil.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/JobUtil.java
new file mode 100644
index 0000000..0d5db2f
--- /dev/null
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/JobUtil.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.examples.simple.mapreduce;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.mapreduce.Job;
+
+public class JobUtil {
+  public static Job getJob(Configuration conf) throws IOException {
+    return new Job(conf);
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/NGramIngest.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/NGramIngest.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/NGramIngest.java
index 8c5fd19..2f9b01a 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/NGramIngest.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/NGramIngest.java
@@ -72,8 +72,8 @@ public class NGramIngest extends Configured implements Tool  {
     Opts opts = new Opts();
     opts.parseArgs(getClass().getName(), args);
 
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), getClass().getSimpleName());
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(getClass().getSimpleName());
     job.setJarByClass(getClass());
     
     opts.setAccumuloConfigs(job);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RegexExample.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RegexExample.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RegexExample.java
index 2980e0a..9acc694 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RegexExample.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RegexExample.java
@@ -61,8 +61,8 @@ public class RegexExample extends Configured implements Tool {
     Opts opts = new Opts();
     opts.parseArgs(getClass().getName(), args);
 
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), getClass().getSimpleName());
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(getClass().getSimpleName());
     job.setJarByClass(getClass());
     
     job.setInputFormatClass(AccumuloInputFormat.class);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RowHash.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RowHash.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RowHash.java
index 0a9e87e..2ca3587 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RowHash.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RowHash.java
@@ -62,8 +62,8 @@ public class RowHash extends Configured implements Tool {
   
   @Override
   public int run(String[] args) throws Exception {
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), this.getClass().getName());
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(this.getClass().getName());
     job.setJarByClass(this.getClass());
     Opts opts = new Opts();
     opts.parseArgs(RowHash.class.getName(), args);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TableToFile.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TableToFile.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TableToFile.java
index c1f113a..8bdc195 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TableToFile.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TableToFile.java
@@ -84,8 +84,8 @@ public class TableToFile extends Configured implements Tool {
   
   @Override
   public int run(String[] args) throws IOException, InterruptedException, ClassNotFoundException,
AccumuloSecurityException {
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
     job.setJarByClass(this.getClass());
     Opts opts = new Opts();
     opts.parseArgs(getClass().getName(), args);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TeraSortIngest.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TeraSortIngest.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TeraSortIngest.java
index 7a77096..dd2fea4 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TeraSortIngest.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TeraSortIngest.java
@@ -369,8 +369,8 @@ public class TeraSortIngest extends Configured implements Tool {
   
   @Override
   public int run(String[] args) throws Exception {
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), "TeraSortCloud");
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName("TeraSortCloud");
     job.setJarByClass(this.getClass());
     Opts opts = new Opts();
     opts.parseArgs(TeraSortIngest.class.getName(), args);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TokenFileWordCount.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TokenFileWordCount.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TokenFileWordCount.java
index 674d793..16e0356 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TokenFileWordCount.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TokenFileWordCount.java
@@ -66,7 +66,7 @@ public class TokenFileWordCount extends Configured implements Tool {
     String input = args[4];
     String tableName = args[5];
     
-    Job job = Job.getInstance(getConf());
+    Job job = JobUtil.getJob(getConf());
     job.setJobName(TokenFileWordCount.class.getName());
     job.setJarByClass(this.getClass());
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/UniqueColumns.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/UniqueColumns.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/UniqueColumns.java
index 4b19749..23d9d47 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/UniqueColumns.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/UniqueColumns.java
@@ -89,8 +89,8 @@ public class UniqueColumns extends Configured implements Tool {
     
     String jobName = this.getClass().getSimpleName() + "_" + System.currentTimeMillis();
 
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), jobName);
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(jobName);
     job.setJarByClass(this.getClass());
     
     String clone = opts.tableName;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/WordCount.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/WordCount.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/WordCount.java
index 80c0fd5..8ca8cbc 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/WordCount.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/WordCount.java
@@ -69,8 +69,8 @@ public class WordCount extends Configured implements Tool {
     Opts opts = new Opts();
     opts.parseArgs(WordCount.class.getName(), args);
 
-    @SuppressWarnings("deprecation")
-    Job job = new Job(getConf(), WordCount.class.getName());
+    Job job = JobUtil.getJob(getConf());
+    job.setJobName(WordCount.class.getName());
     job.setJarByClass(this.getClass());
     
     job.setInputFormatClass(TextInputFormat.class);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
index 11660f3..2b3289e 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
@@ -29,6 +29,7 @@ import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.TextUtil;
+import org.apache.accumulo.examples.simple.mapreduce.JobUtil;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configured;
@@ -107,8 +108,8 @@ public class BulkIngestExample extends Configured implements Tool {
     Configuration conf = getConf();
     PrintStream out = null;
     try {
-      @SuppressWarnings("deprecation")
-      Job job = new Job(conf, "bulk ingest example");
+      Job job = JobUtil.getJob(conf);
+      job.setJobName("bulk ingest example");
       job.setJarByClass(this.getClass());
       
       job.setInputFormatClass(TextInputFormat.class);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/d868e30d/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
index 3274189..3d99838 100644
--- a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
+++ b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
@@ -35,6 +35,7 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.examples.simple.mapreduce.JobUtil;
 import org.apache.hadoop.conf.Configured;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.Mapper;
@@ -193,8 +194,8 @@ public class ChunkInputFormatTest extends TestCase {
       String pass = args[2];
       String table = args[3];
 
-      @SuppressWarnings("deprecation")
-      Job job = new Job(getConf(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
+      Job job = JobUtil.getJob(getConf());
+      job.setJobName(this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
       job.setJarByClass(this.getClass());
       
       job.setInputFormatClass(ChunkInputFormat.class);


Mime
View raw message