diff options
author | Tathagata Das <tathagata.das1565@gmail.com> | 2012-10-22 15:31:19 -0700 |
---|---|---|
committer | Tathagata Das <tathagata.das1565@gmail.com> | 2012-10-22 15:31:19 -0700 |
commit | 2c87c853ba24f55c142e4864b14c62d0a82a82df (patch) | |
tree | d7b2b48ac5374457e83640a31e05177ec81816d7 /streaming | |
parent | d85c66636ba3b5d32f7e3b47c5b68e1064f8f588 (diff) | |
download | spark-2c87c853ba24f55c142e4864b14c62d0a82a82df.tar.gz spark-2c87c853ba24f55c142e4864b14c62d0a82a82df.tar.bz2 spark-2c87c853ba24f55c142e4864b14c62d0a82a82df.zip |
Renamed examples
Diffstat (limited to 'streaming')
-rw-r--r-- | streaming/src/main/scala/spark/streaming/examples/FileStream.scala (renamed from streaming/src/main/scala/spark/streaming/examples/ExampleTwo.scala) | 8 | ||||
-rw-r--r-- | streaming/src/main/scala/spark/streaming/examples/QueueStream.scala (renamed from streaming/src/main/scala/spark/streaming/examples/ExampleOne.scala) | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/streaming/src/main/scala/spark/streaming/examples/ExampleTwo.scala b/streaming/src/main/scala/spark/streaming/examples/FileStream.scala index ad563e2c75..301da56014 100644 --- a/streaming/src/main/scala/spark/streaming/examples/ExampleTwo.scala +++ b/streaming/src/main/scala/spark/streaming/examples/FileStream.scala @@ -7,15 +7,15 @@ import org.apache.hadoop.fs.Path import org.apache.hadoop.conf.Configuration -object ExampleTwo { +object FileStream { def main(args: Array[String]) { if (args.length < 2) { - System.err.println("Usage: ExampleOne <master> <new HDFS compatible directory>") + System.err.println("Usage: FileStream <master> <new HDFS compatible directory>") System.exit(1) } // Create the context and set the batch size - val ssc = new StreamingContext(args(0), "ExampleTwo") + val ssc = new StreamingContext(args(0), "FileStream") ssc.setBatchDuration(Seconds(2)) // Create the new directory @@ -23,6 +23,7 @@ object ExampleTwo { val fs = directory.getFileSystem(new Configuration()) if (fs.exists(directory)) throw new Exception("This directory already exists") fs.mkdirs(directory) + fs.deleteOnExit(directory) // Create the FileInputDStream on the directory and use the // stream to count words in new files created @@ -41,7 +42,6 @@ object ExampleTwo { } Thread.sleep(5000) // Waiting for the file to be processed ssc.stop() - fs.delete(directory) System.exit(0) } }
\ No newline at end of file diff --git a/streaming/src/main/scala/spark/streaming/examples/ExampleOne.scala b/streaming/src/main/scala/spark/streaming/examples/QueueStream.scala index 2ff8790e77..ae701bba6d 100644 --- a/streaming/src/main/scala/spark/streaming/examples/ExampleOne.scala +++ b/streaming/src/main/scala/spark/streaming/examples/QueueStream.scala @@ -7,16 +7,16 @@ import spark.streaming.Seconds import scala.collection.mutable.SynchronizedQueue -object ExampleOne { +object QueueStream { def main(args: Array[String]) { if (args.length < 1) { - System.err.println("Usage: ExampleOne <master>") + System.err.println("Usage: QueueStream <master>") System.exit(1) } // Create the context and set the batch size - val ssc = new StreamingContext(args(0), "ExampleOne") + val ssc = new StreamingContext(args(0), "QueueStream") ssc.setBatchDuration(Seconds(1)) // Create the queue through which RDDs can be pushed to |