aboutsummaryrefslogtreecommitdiff
path: root/wordcount/multilang/resources/splitbolt.py
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2021-10-25 14:34:37 -0600
committerCody Hiar <cody@hiar.ca>2021-10-25 14:34:37 -0600
commite3d2ffca585660f0c088ab8323bfe78a86ba75e3 (patch)
tree1f542c4d1c032cdc85149ccfd28cafc402ddb3d0 /wordcount/multilang/resources/splitbolt.py
parent08cf73a70e3ce2dbc85e8b389f15090c148ec003 (diff)
Save working version of deploying jars
Diffstat (limited to 'wordcount/multilang/resources/splitbolt.py')
-rw-r--r--wordcount/multilang/resources/splitbolt.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/wordcount/multilang/resources/splitbolt.py b/wordcount/multilang/resources/splitbolt.py
new file mode 100644
index 0000000..b46a901
--- /dev/null
+++ b/wordcount/multilang/resources/splitbolt.py
@@ -0,0 +1,21 @@
+import storm
+
+class SplitBolt(storm.BasicBolt):
+ # There's nothing to initialize here,
+ # since this is just a split and emit
+ # Initialize this instance
+ def initialize(self, conf, context):
+ self._conf = conf
+ self._context = context
+ storm.logInfo("Split bolt instance starting...")
+
+ def process(self, tup):
+ # Split the inbound sentence at spaces
+ words = tup.values[0].split()
+ # Loop over words and emit
+ for word in words:
+ storm.logInfo("Emitting %s" % word)
+ storm.emit([word])
+
+# Start the bolt when it's invoked
+SplitBolt().run()