Skip to content
Snippets Groups Projects
Commit 176193b1 authored by James Phillpotts's avatar James Phillpotts
Browse files

Fix usage and parameter extraction

parent 366572ed
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,8 @@ import spark.SparkContext._ ...@@ -26,8 +26,8 @@ import spark.SparkContext._
*/ */
object TwitterAlgebirdCMS { object TwitterAlgebirdCMS {
def main(args: Array[String]) { def main(args: Array[String]) {
if (args.length < 3) { if (args.length < 1) {
System.err.println("Usage: TwitterAlgebirdCMS <master> <twitter_username> <twitter_password>" + System.err.println("Usage: TwitterAlgebirdCMS <master>" +
" [filter1] [filter2] ... [filter n]") " [filter1] [filter2] ... [filter n]")
System.exit(1) System.exit(1)
} }
...@@ -40,8 +40,7 @@ object TwitterAlgebirdCMS { ...@@ -40,8 +40,7 @@ object TwitterAlgebirdCMS {
// K highest frequency elements to take // K highest frequency elements to take
val TOPK = 10 val TOPK = 10
val Array(master, username, password) = args.slice(0, 3) val (master, filters) = (args.head, args.tail)
val filters = args.slice(3, args.length)
val ssc = new StreamingContext(master, "TwitterAlgebirdCMS", Seconds(10), val ssc = new StreamingContext(master, "TwitterAlgebirdCMS", Seconds(10),
System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR"))) System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR")))
......
...@@ -21,16 +21,15 @@ import spark.streaming.dstream.TwitterInputDStream ...@@ -21,16 +21,15 @@ import spark.streaming.dstream.TwitterInputDStream
*/ */
object TwitterAlgebirdHLL { object TwitterAlgebirdHLL {
def main(args: Array[String]) { def main(args: Array[String]) {
if (args.length < 3) { if (args.length < 1) {
System.err.println("Usage: TwitterAlgebirdHLL <master> <twitter_username> <twitter_password>" + System.err.println("Usage: TwitterAlgebirdHLL <master>" +
" [filter1] [filter2] ... [filter n]") " [filter1] [filter2] ... [filter n]")
System.exit(1) System.exit(1)
} }
/** Bit size parameter for HyperLogLog, trades off accuracy vs size */ /** Bit size parameter for HyperLogLog, trades off accuracy vs size */
val BIT_SIZE = 12 val BIT_SIZE = 12
val Array(master, username, password) = args.slice(0, 3) val (master, filters) = (args.head, args.tail)
val filters = args.slice(3, args.length)
val ssc = new StreamingContext(master, "TwitterAlgebirdHLL", Seconds(5), val ssc = new StreamingContext(master, "TwitterAlgebirdHLL", Seconds(5),
System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR"))) System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR")))
......
...@@ -12,14 +12,13 @@ import spark.SparkContext._ ...@@ -12,14 +12,13 @@ import spark.SparkContext._
*/ */
object TwitterPopularTags { object TwitterPopularTags {
def main(args: Array[String]) { def main(args: Array[String]) {
if (args.length < 3) { if (args.length < 1) {
System.err.println("Usage: TwitterPopularTags <master> <twitter_username> <twitter_password>" + System.err.println("Usage: TwitterPopularTags <master>" +
" [filter1] [filter2] ... [filter n]") " [filter1] [filter2] ... [filter n]")
System.exit(1) System.exit(1)
} }
val Array(master, username, password) = args.slice(0, 3) val (master, filters) = (args.head, args.tail)
val filters = args.slice(3, args.length)
val ssc = new StreamingContext(master, "TwitterPopularTags", Seconds(2), val ssc = new StreamingContext(master, "TwitterPopularTags", Seconds(2),
System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR"))) System.getenv("SPARK_HOME"), Seq(System.getenv("SPARK_EXAMPLES_JAR")))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment