wukong-storm 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +1 -2
- data/Gemfile +1 -1
- data/README.md +174 -18
- data/bin/wu-bolt +4 -0
- data/lib/wukong-storm.rb +50 -10
- data/lib/wukong-storm/bolt_driver.rb +81 -0
- data/lib/wukong-storm/bolt_runner.rb +44 -0
- data/lib/wukong-storm/storm_invocation.rb +386 -0
- data/lib/wukong-storm/storm_runner.rb +123 -0
- data/lib/wukong-storm/version.rb +1 -1
- data/lib/wukong-storm/wukong-storm.jar +0 -0
- data/pom.xml +111 -0
- data/spec/spec_helper.rb +13 -1
- data/spec/wukong-storm/bolt_driver_spec.rb +46 -0
- data/spec/wukong-storm/storm_invocation_spec.rb +204 -0
- data/spec/wukong-storm/storm_runner_spec.rb +76 -0
- data/spec/{wu_storm_spec.rb → wukong-storm/wu-bolt_spec.rb} +14 -14
- data/spec/wukong-storm/wu-storm_spec.rb +17 -0
- data/spec/wukong-storm_spec.rb +5 -0
- data/src/main/java/com/infochimps/wukong/storm/Builder.java +53 -0
- data/src/main/java/com/infochimps/wukong/storm/DataflowBuilder.java +74 -0
- data/src/main/java/com/infochimps/wukong/storm/SpoutBuilder.java +237 -0
- data/src/main/java/com/infochimps/wukong/storm/StateBuilder.java +46 -0
- data/src/main/java/com/infochimps/wukong/storm/TopologyBuilder.java +130 -0
- data/src/main/java/com/infochimps/wukong/storm/TopologySubmitter.java +181 -0
- data/wukong-storm.gemspec +3 -2
- metadata +49 -11
- data/lib/wukong-storm/driver.rb +0 -58
- data/lib/wukong-storm/runner.rb +0 -40
data/lib/wukong-storm/driver.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
module Wukong
|
2
|
-
module Storm
|
3
|
-
|
4
|
-
# A driver to connect events passed in over STDIN to STDOUT.
|
5
|
-
# Differs from the vanilla Wukong::Local::LocalDriver in some
|
6
|
-
# Storm-specific ways.
|
7
|
-
class StormDriver < EM::P::LineAndTextProtocol
|
8
|
-
include DriverMethods
|
9
|
-
|
10
|
-
attr_accessor :dataflow, :settings
|
11
|
-
|
12
|
-
def self.start(label, settings = {})
|
13
|
-
EM.attach($stdin, self, label, settings)
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(label, settings)
|
17
|
-
super
|
18
|
-
@settings = settings
|
19
|
-
@dataflow = construct_dataflow(label, settings)
|
20
|
-
@messages = []
|
21
|
-
end
|
22
|
-
|
23
|
-
def post_init
|
24
|
-
setup_dataflow
|
25
|
-
end
|
26
|
-
|
27
|
-
def receive_line line
|
28
|
-
driver.send_through_dataflow(line)
|
29
|
-
send_messages
|
30
|
-
rescue => e
|
31
|
-
raise Wukong::Error.new(e)
|
32
|
-
EM.stop
|
33
|
-
end
|
34
|
-
|
35
|
-
def send_messages
|
36
|
-
# message newline message newline message delimiter
|
37
|
-
# message newline message newline message newline delimiter newline
|
38
|
-
@messages.each do |message|
|
39
|
-
$stdout.write(message)
|
40
|
-
$stdout.write("\n")
|
41
|
-
end
|
42
|
-
$stdout.write(settings.delimiter)
|
43
|
-
$stdout.write("\n")
|
44
|
-
$stdout.flush
|
45
|
-
@messages.clear
|
46
|
-
end
|
47
|
-
|
48
|
-
def unbind
|
49
|
-
EM.stop
|
50
|
-
end
|
51
|
-
|
52
|
-
def setup() ; end
|
53
|
-
def process(record) @messages << record ; end
|
54
|
-
def stop() ; end
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/lib/wukong-storm/runner.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require_relative('driver')
|
2
|
-
|
3
|
-
module Wukong
|
4
|
-
module Storm
|
5
|
-
|
6
|
-
# Implements the runner for wu-storm.
|
7
|
-
class StormRunner < Wukong::Local::LocalRunner
|
8
|
-
|
9
|
-
include Wukong::Logging
|
10
|
-
|
11
|
-
usage "PROCESSOR|FLOW"
|
12
|
-
|
13
|
-
description <<-EOF.gsub(/^ {8}/,'')
|
14
|
-
wu-storm is a commandline tool for running Wukong processors and flows
|
15
|
-
in a storm or trident topology.
|
16
|
-
|
17
|
-
wu-storm operates over STDIN and STDOUT and has a one-to-one message
|
18
|
-
guarantee. For example, when using an identity processor, wu-storm,
|
19
|
-
given an event 'foo', will return 'foo|'. The '|' character is the
|
20
|
-
specified End-Of-File delimiter.
|
21
|
-
|
22
|
-
If there is ever a suppressed error in pricessing, or a skipped record
|
23
|
-
for any reason, wu-storm will still respond with a '|', signifying an
|
24
|
-
empty return event.
|
25
|
-
|
26
|
-
If there are multiple messages that have resulted from a single event,
|
27
|
-
wu-storm will return them newline separated, followed by the
|
28
|
-
delimiter, e.g. 'foo\nbar\nbaz|'.
|
29
|
-
EOF
|
30
|
-
|
31
|
-
# :nodoc:
|
32
|
-
def driver
|
33
|
-
StormDriver
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
|