Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
cbf6a5ee
Commit
cbf6a5ee
authored
12 years ago
by
unknown
Browse files
Options
Downloads
Patches
Plain Diff
Removed unused code, clarified intent of the program, batch size to 1 second
parent
1d54401d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/src/main/scala/spark/streaming/examples/StatefulNetworkWordCount.scala
+3
-5
3 additions, 5 deletions
...a/spark/streaming/examples/StatefulNetworkWordCount.scala
with
3 additions
and
5 deletions
examples/src/main/scala/spark/streaming/examples/StatefulNetworkWordCount.scala
+
3
−
5
View file @
cbf6a5ee
...
@@ -4,7 +4,7 @@ import spark.streaming._
...
@@ -4,7 +4,7 @@ import spark.streaming._
import
spark.streaming.StreamingContext._
import
spark.streaming.StreamingContext._
/**
/**
* Counts words in UTF8 encoded, '\n' delimited text received from the network every second.
* Counts words
cumulatively
in UTF8 encoded, '\n' delimited text received from the network every second.
* Usage: StatefulNetworkWordCount <master> <hostname> <port>
* Usage: StatefulNetworkWordCount <master> <hostname> <port>
* <master> is the Spark master URL. In local mode, <master> should be 'local[n]' with n > 1.
* <master> is the Spark master URL. In local mode, <master> should be 'local[n]' with n > 1.
* <hostname> and <port> describe the TCP server that Spark Streaming would connect to receive data.
* <hostname> and <port> describe the TCP server that Spark Streaming would connect to receive data.
...
@@ -15,8 +15,6 @@ import spark.streaming.StreamingContext._
...
@@ -15,8 +15,6 @@ import spark.streaming.StreamingContext._
* `$ ./run spark.streaming.examples.StatefulNetworkWordCount local[2] localhost 9999`
* `$ ./run spark.streaming.examples.StatefulNetworkWordCount local[2] localhost 9999`
*/
*/
object
StatefulNetworkWordCount
{
object
StatefulNetworkWordCount
{
private
def
className
[
A
](
a
:
A
)(
implicit
m
:
Manifest
[
A
])
=
m
.
toString
def
main
(
args
:
Array
[
String
])
{
def
main
(
args
:
Array
[
String
])
{
if
(
args
.
length
<
3
)
{
if
(
args
.
length
<
3
)
{
System
.
err
.
println
(
"Usage: StatefulNetworkWordCount <master> <hostname> <port>\n"
+
System
.
err
.
println
(
"Usage: StatefulNetworkWordCount <master> <hostname> <port>\n"
+
...
@@ -32,8 +30,8 @@ object StatefulNetworkWordCount {
...
@@ -32,8 +30,8 @@ object StatefulNetworkWordCount {
Some
(
currentCount
+
previousCount
)
Some
(
currentCount
+
previousCount
)
}
}
// Create the context with a 1
0
second batch size
// Create the context with a 1 second batch size
val
ssc
=
new
StreamingContext
(
args
(
0
),
"NetworkWordCumulativeCountUpdateStateByKey"
,
Seconds
(
1
0
),
val
ssc
=
new
StreamingContext
(
args
(
0
),
"NetworkWordCumulativeCountUpdateStateByKey"
,
Seconds
(
1
),
System
.
getenv
(
"SPARK_HOME"
),
Seq
(
System
.
getenv
(
"SPARK_EXAMPLES_JAR"
)))
System
.
getenv
(
"SPARK_HOME"
),
Seq
(
System
.
getenv
(
"SPARK_EXAMPLES_JAR"
)))
ssc
.
checkpoint
(
"."
)
ssc
.
checkpoint
(
"."
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment