Skip to content

Commit f16b464

Browse files
author
Martin Durant
committed
simplify
1 parent b382a65 commit f16b464

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

examples/network_wordcount.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22
""" a recreation of spark-streaming's network_wordcount
33
44
https://spark.apache.org/docs/2.2.0/streaming-programming-guide.html#a-quick-example
5-
6-
Run this within an interactive session, or with
7-
> python -i -network_wordcount.py
8-
so that python won't exit before producing output.
95
"""
10-
6+
import time
117
from streamz import Stream
128

139
# absolute port on localhost for now
1410
s = Stream.from_tcp(9999)
1511
s.map(bytes.split).flatten().frequencies().sink(print)
1612

1713
print(
18-
"""In another terminal executs
14+
"""In another terminal execute
1915
> nc 127.0.0.1 9999
2016
and then start typing content
2117
"""
2218
)
2319

2420
s.start()
21+
time.sleep(600)

0 commit comments

Comments
 (0)