We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8783b3f commit b382a65Copy full SHA for b382a65
examples/network_wordcount.py
@@ -0,0 +1,24 @@
1
+#! /usr/env python
2
+""" a recreation of spark-streaming's network_wordcount
3
+
4
+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.
9
+"""
10
11
+from streamz import Stream
12
13
+# absolute port on localhost for now
14
+s = Stream.from_tcp(9999)
15
+s.map(bytes.split).flatten().frequencies().sink(print)
16
17
+print(
18
+ """In another terminal executs
19
+> nc 127.0.0.1 9999
20
+and then start typing content
21
22
+)
23
24
+s.start()
0 commit comments