aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src
diff options
context:
space:
mode:
Diffstat (limited to 'scalding/src')
-rw-r--r--scalding/src/main/scala/sandcrawler/HBaseMimeCountJob.scala18
-rw-r--r--scalding/src/main/scala/sandcrawler/HBaseRowCountJob.scala21
-rw-r--r--scalding/src/test/scala/sandcrawler/HBaseMimeCountTest.scala5
-rw-r--r--scalding/src/test/scala/sandcrawler/HBaseRowCountTest.scala5
4 files changed, 32 insertions, 17 deletions
diff --git a/scalding/src/main/scala/sandcrawler/HBaseMimeCountJob.scala b/scalding/src/main/scala/sandcrawler/HBaseMimeCountJob.scala
index 819a652..a6ab53a 100644
--- a/scalding/src/main/scala/sandcrawler/HBaseMimeCountJob.scala
+++ b/scalding/src/main/scala/sandcrawler/HBaseMimeCountJob.scala
@@ -9,9 +9,11 @@ import parallelai.spyglass.hbase.{HBaseSource, HBasePipeConversions}
import parallelai.spyglass.hbase.HBaseConstants.SourceMode
class HBaseMimeCountJob(args: Args) extends JobBase(args) with HBasePipeConversions {
+
val output = args("output")
- HBaseMimeCountJob.getHBaseSource
+ HBaseMimeCountJob.getHBaseSource(args("hbase-table"),
+ args("zookeeper-hosts"))
.read
.fromBytesWritable(List('mime))
.debug
@@ -20,9 +22,13 @@ class HBaseMimeCountJob(args: Args) extends JobBase(args) with HBasePipeConversi
}
object HBaseMimeCountJob {
- def getHBaseSource = HBaseBuilder.build(
- "wbgrp-journal-extract-0-qa", // HBase Table Name
- "mtrcs-zk1.us.archive.org:2181", // HBase Zookeeper server (to get runtime config info; can be array?)
- List("file:mime"),
- SourceMode.SCAN_ALL)
+
+ def getHBaseSource(hbase_table: String, zookeeper_hosts: String) : HBaseSource = {
+ return HBaseBuilder.build(
+ hbase_table,
+ zookeeper_hosts,
+ List("file:mime"),
+ SourceMode.SCAN_ALL)
+ }
+
}
diff --git a/scalding/src/main/scala/sandcrawler/HBaseRowCountJob.scala b/scalding/src/main/scala/sandcrawler/HBaseRowCountJob.scala
index 0c8e615..7f5c84a 100644
--- a/scalding/src/main/scala/sandcrawler/HBaseRowCountJob.scala
+++ b/scalding/src/main/scala/sandcrawler/HBaseRowCountJob.scala
@@ -10,12 +10,10 @@ import parallelai.spyglass.hbase.HBaseConstants.SourceMode
class HBaseRowCountJob(args: Args) extends JobBase(args) with HBasePipeConversions {
-
- // For now doesn't actually count, just dumps a "word count"
-
val output = args("output")
- HBaseRowCountJob.getHBaseSource
+ HBaseRowCountJob.getHBaseSource(args("hbase-table"),
+ args("zookeeper-hosts"))
.read
.debug
.groupAll { _.size('count) }
@@ -23,9 +21,14 @@ class HBaseRowCountJob(args: Args) extends JobBase(args) with HBasePipeConversio
}
object HBaseRowCountJob {
- def getHBaseSource = HBaseBuilder.build(
- "wbgrp-journal-extract-0-qa", // HBase Table Name
- "mtrcs-zk1.us.archive.org:2181", // HBase Zookeeper server (to get runtime config info; can be array?)
- List("file:size", "file:mime"),
- SourceMode.SCAN_ALL)
+
+ // eg, "wbgrp-journal-extract-0-qa", "mtrcs-zk1.us.archive.org:2181"
+ def getHBaseSource(hbase_table: String, zookeeper_hosts: String) : HBaseSource = {
+ return HBaseBuilder.build(
+ hbase_table,
+ zookeeper_hosts,
+ List("file:size"),
+ SourceMode.SCAN_ALL)
+ }
+
}
diff --git a/scalding/src/test/scala/sandcrawler/HBaseMimeCountTest.scala b/scalding/src/test/scala/sandcrawler/HBaseMimeCountTest.scala
index eb6f4ff..dfcfcdb 100644
--- a/scalding/src/test/scala/sandcrawler/HBaseMimeCountTest.scala
+++ b/scalding/src/test/scala/sandcrawler/HBaseMimeCountTest.scala
@@ -16,6 +16,7 @@ import scala._
class HBaseMimeCountTest extends FunSpec with TupleConversions {
val output = "/tmp/testOutput"
+ val (test_table, test_host) = ("test-table", "dummy-host:2181")
val log = LoggerFactory.getLogger(this.getClass.getName)
@@ -40,8 +41,10 @@ class HBaseMimeCountTest extends FunSpec with TupleConversions {
.arg("test", "")
.arg("app.conf.path", "app.conf")
.arg("output", output)
+ .arg("hbase-table", test_table)
+ .arg("zookeeper-hosts", test_host)
.arg("debug", "true")
- .source[Tuple](HBaseMimeCountJob.getHBaseSource,
+ .source[Tuple](HBaseMimeCountJob.getHBaseSource(test_table, test_host),
sampleData.map(l => new Tuple(l.map(s => {new ImmutableBytesWritable(Bytes.toBytes(s))}):_*)))
.sink[Tuple](Tsv(output)) {
outputBuffer =>
diff --git a/scalding/src/test/scala/sandcrawler/HBaseRowCountTest.scala b/scalding/src/test/scala/sandcrawler/HBaseRowCountTest.scala
index 6f61eb3..a5c35a2 100644
--- a/scalding/src/test/scala/sandcrawler/HBaseRowCountTest.scala
+++ b/scalding/src/test/scala/sandcrawler/HBaseRowCountTest.scala
@@ -19,6 +19,7 @@ import scala._
class HBaseRowCountTest extends FunSpec with TupleConversions {
val output = "/tmp/testOutput"
+ val (test_table, test_host) = ("test-table", "dummy-host:2181")
val log = LoggerFactory.getLogger(this.getClass.getName)
@@ -37,8 +38,10 @@ class HBaseRowCountTest extends FunSpec with TupleConversions {
.arg("test", "")
.arg("app.conf.path", "app.conf")
.arg("output", output)
+ .arg("hbase-table", test_table)
+ .arg("zookeeper-hosts", test_host)
.arg("debug", "true")
- .source[Tuple](HBaseRowCountJob.getHBaseSource,
+ .source[Tuple](HBaseRowCountJob.getHBaseSource(test_table, test_host),
sampleData.map(l => new Tuple(l.map(s => {new ImmutableBytesWritable(Bytes.toBytes(s))}):_*)))
.sink[Tuple](Tsv(output)) {
outputBuffer =>