Skip to content

Commit

Permalink
fix python style
Browse files Browse the repository at this point in the history
  • Loading branch information
davies committed Sep 26, 2014
1 parent bd27874 commit 9a57685
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/src/main/python/streaming/network_wordcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
if len(sys.argv) != 3:
print >> sys.stderr, "Usage: wordcount <hostname> <port>"
exit(-1)
ssc = StreamingContext(appName="PythonStreamingNetworkWordCount",
ssc = StreamingContext(appName="PythonStreamingNetworkWordCount",
duration=Seconds(1))

lines = ssc.socketTextStream(sys.argv[1], int(sys.argv[2]))
counts = lines.flatMap(lambda line: line.split(" "))\
.map(lambda word: (word, 1))\
.reduceByKey(lambda a,b: a+b)
.reduceByKey(lambda a, b: a+b)
counts.pyprint()

ssc.start()
Expand Down

0 comments on commit 9a57685

Please sign in to comment.