redstorm 0.6.6.beta1 → 0.6.6.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -82,7 +82,7 @@
82
82
  - issue #73, external jars dependencies Ivy configurations completely externalized and configurable
83
83
  - lots of other [bug fixes and improvements](https://github.com/colinsurprenant/redstorm/issues?milestone=9&page=1&state=closed)
84
84
 
85
- # 0.6.6, WIP
85
+ # 0.6.6.beta1, 07-02-2013
86
86
  - Storm 0.9.0-wip16 and JRuby 1.7.4
87
87
  - [issue #79](https://github.com/colinsurprenant/redstorm/issues/79) - fix example Kafka topology dependency doc
88
88
  - [issue #82](https://github.com/colinsurprenant/redstorm/issues/82) - configurable javac compilation source/target
@@ -92,3 +92,6 @@
92
92
  - fixed FFI support
93
93
  - exposed topology builder for specs
94
94
  - [issue #11](https://github.com/colinsurprenant/redstorm/issues/11), [#17](https://github.com/colinsurprenant/redstorm/issues/17) - example specs using the Storm testing API see [redstorm-starter](https://github.com/colinsurprenant/redstorm-starter/)
95
+
96
+ # 0.6.6.beta2, 07-20-2013
97
+ - [issue #76](https://github.com/colinsurprenant/redstorm/issues/76) - avoid shelling out to storm jar command for cluster submission
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RedStorm v0.6.6.beta1 - JRuby on Storm
1
+ # RedStorm v0.6.6.beta2 - JRuby on Storm
2
2
 
3
3
  [![build status](https://secure.travis-ci.org/colinsurprenant/redstorm.png)](http://travis-ci.org/colinsurprenant/redstorm)
4
4
 
@@ -13,6 +13,11 @@ Check also these related projects:
13
13
 
14
14
  ## Documentation
15
15
 
16
+ ---
17
+ This is the documentation for the **current WIP version of RedStorm** - the **[latest released Gem is v0.6.5](wiki/RedStorm-Gem-v0.6.5-Documentation)**
18
+
19
+ ---
20
+
16
21
  Chances are new versions of RedStorm will introduce changes that will break compatibility or change the developement workflow. To prevent out-of-sync documentation, per version specific documentation are kept [in the wiki](https://github.com/colinsurprenant/redstorm/wiki) when necessary.
17
22
 
18
23
  ## Dependencies
@@ -24,14 +29,14 @@ Tested on **OSX 10.8.3** and **Ubuntu Linux 12.10** using **Storm 0.9.0-wip16**
24
29
  - RubyGems
25
30
 
26
31
  ``` sh
27
- $ gem install redstorm
32
+ $ gem install redstorm --pre
28
33
  ```
29
34
 
30
35
  - Bundler
31
36
 
32
37
  ``` ruby
33
38
  source "https://rubygems.org"
34
- gem "redstorm", "~> 0.6.6.beta1"
39
+ gem "redstorm", "~> 0.6.6.beta2"
35
40
  ```
36
41
 
37
42
  ## Usage
@@ -60,6 +65,12 @@ $ redstorm install
60
65
 
61
66
  This will install default Java jar dependencies in `target/dependency`, generate & compile the Java bindings in `target/classes`.
62
67
 
68
+ By default, the Java compilation will use the current JVM version as source/target compilation compatibility. If you want to force a specific source/target version, use the `--[JVM VERSION]` option. For example, to force compiling for 1.6 use:
69
+
70
+ ``` sh
71
+ $ redstorm install --1.6
72
+ ```
73
+
63
74
  ### Create a topology
64
75
 
65
76
  Create a subdirectory for your topology code and create your topology class **using this naming convention**: *underscore* topology_class_file_name.rb **MUST** correspond to its *CamelCase* class name.
@@ -76,7 +87,7 @@ end
76
87
 
77
88
  class HelloWorldBolt < RedStorm::DSL::Bolt
78
89
  on_receive :emit => false do |tuple|
79
- log.info(tuple.getString(0))
90
+ log.info(tuple[0])
80
91
  end
81
92
  end
82
93
 
@@ -185,30 +196,34 @@ $ java -Djruby.compat.version=RUBY1_9 -cp "target/classes:target/dependency/stor
185
196
 
186
197
  ### Run on production cluster
187
198
 
188
- The Storm distribution is currently required for the cluster topology submission.
189
-
190
- 1. download and unpack the [Storm 0.9.0-wip16 distribution](https://dl.dropbox.com/u/133901206/storm-0.9.0-wip16.zip) locally
199
+ Locally installing the Storm distribution is **not required**. Note that RedStorm does not provide the Storm command line utilities and you will need to install the Storm distribution to use the Storm command line utilities.
191
200
 
192
- 2. add the Storm `bin/` directory to your `$PATH`
193
-
194
- 3. create `~/.storm/storm.yaml` and add the following
201
+ 1. create the Storm config file `~/.storm/storm.yaml` and add the following
195
202
 
196
203
  ```yaml
197
204
  nimbus.host: "host_name_or_ip"
198
205
  ```
199
206
 
200
- 4. generate `target/cluster-topology.jar`. This jar file will include your sources directory plus the required dependencies
207
+ you can also use an alternate path and use the `--config <other/path/to/config.yaml>`
208
+
209
+ 2. generate `target/cluster-topology.jar`. This jar file will include your sources directory plus the required dependencies
201
210
 
202
211
  ``` sh
203
212
  $ redstorm jar <sources_directory1> <sources_directory2> ...
204
213
  ```
205
214
 
206
- 5. submit the cluster topology jar file to the cluster
215
+ 3. submit the cluster topology jar file to the cluster
207
216
 
208
217
  ``` sh
209
218
  $ redstorm cluster <sources_directory/topology_class_file_name.rb>
210
219
  ```
211
220
 
221
+ or if you have an alternate Storm config path:
222
+
223
+ ``` sh
224
+ $ redstorm cluster --config <some/other/path/to/config.yaml> <sources_directory/topology_class_file_name.rb>
225
+ ```
226
+
212
227
  note that the cluster topology jar can also be submitted using the storm command with:
213
228
 
214
229
  ``` sh
@@ -273,13 +288,13 @@ All examples using the [DSL](https://github.com/colinsurprenant/redstorm/wiki/Ru
273
288
 
274
289
  #### Topologies without gems
275
290
 
276
- 1. genererate the `target/cluster-topology.jar` and include the `examples/` directory.
291
+ 1. genererate the `target/cluster-topology.jar` and include the `examples/` directory
277
292
 
278
293
  ``` sh
279
294
  $ redstorm jar examples
280
295
  ```
281
296
 
282
- 2. submit the cluster topology jar file to the cluster, assuming you have the Storm distribution installed and the Storm `bin/` directory in your path:
297
+ 2. submit the cluster topology jar file to the cluster
283
298
 
284
299
  ``` sh
285
300
  $ redstorm cluster examples/dsl/exclamation_topology.rb
@@ -309,13 +324,13 @@ For `examples/dsl/redis_word_count_topology.rb` the `redis` gem is required and
309
324
  $ redstorm bundle word_count
310
325
  ```
311
326
 
312
- 3. genererate the `target/cluster-topology.jar` and include the `examples/` directory.
327
+ 3. genererate the `target/cluster-topology.jar` and include the `examples/` directory
313
328
 
314
329
  ``` sh
315
330
  $ redstorm jar examples
316
331
  ```
317
332
 
318
- 4. submit the cluster topology jar file to the cluster, assuming you have the Storm distribution installed and the Storm `bin/` directory in your path:
333
+ 4. submit the cluster topology jar file to the cluster
319
334
 
320
335
  ``` sh
321
336
  $ redstorm cluster examples/dsl/redis_word_count_topology.rb
@@ -404,6 +419,12 @@ It is possible to fork the RedStorm project and run local and remote/cluster top
404
419
  $ bundle exec redstorm build
405
420
  ```
406
421
 
422
+ By default, the Java compilation will use the current JVM version as source/target compilation compatibility. If you want to force a specific source/target version, use the `--[JVM VERSION]` option. For example, to force compiling for 1.6 use:
423
+
424
+ ``` sh
425
+ $ bundle exec redstorm build --1.6
426
+ ```
427
+
407
428
  **if you modify any of the RedStorm Ruby code or Java binding code**, you need to run this to refresh code and rebuild the bindings
408
429
 
409
430
  - follow the normal usage patterns to run the topology in local or remote cluster.
@@ -27,6 +27,8 @@ CUSTOM_IVY_STORM_DEPENDENCIES = "#{DST_IVY_DIR}/storm_dependencies.xml"
27
27
  DEFAULT_IVY_TOPOLOGY_DEPENDENCIES = "#{SRC_IVY_DIR}/topology_dependencies.xml"
28
28
  CUSTOM_IVY_TOPOLOGY_DEPENDENCIES = "#{DST_IVY_DIR}/topology_dependencies.xml"
29
29
 
30
+ DEFAULT_STORM_CONF_FILE = File.expand_path("~/.storm/storm.yaml")
31
+
30
32
  module RedStorm
31
33
 
32
34
  class Application
@@ -34,11 +36,11 @@ module RedStorm
34
36
 
35
37
  def self.local_storm_command(class_file, ruby_mode = nil)
36
38
  src_dir = File.expand_path(File.dirname(class_file))
37
- "java -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/storm/default/*:#{TARGET_DEPENDENCY_DIR}/topology/default/*:#{src_dir}/\" redstorm.TopologyLauncher local #{class_file}"
39
+ "java -server -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/storm/default/*:#{TARGET_DEPENDENCY_DIR}/topology/default/*:#{src_dir}/\" redstorm.TopologyLauncher local #{class_file}"
38
40
  end
39
41
 
40
- def self.cluster_storm_command(class_file, ruby_mode = nil)
41
- "storm jar #{TARGET_CLUSTER_JAR} -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} redstorm.TopologyLauncher cluster #{class_file}"
42
+ def self.cluster_storm_command(storm_conf, class_file, ruby_mode = nil)
43
+ "java -client -Dstorm.conf.file=#{File.basename(storm_conf)} -Dstorm.jar=#{TARGET_CLUSTER_JAR} -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp #{TARGET_DEPENDENCY_DIR}/storm/default/*:#{TARGET_CLUSTER_JAR}:#{File.dirname(storm_conf)} redstorm.TopologyLauncher cluster #{class_file}"
42
44
  end
43
45
 
44
46
  def self.usage
@@ -50,10 +52,12 @@ module RedStorm
50
52
  puts(" redstorm bundle [BUNDLER_GROUP]")
51
53
  puts(" redstorm jar DIR1, [DIR2, ...]")
52
54
  puts(" redstorm local [--1.8|--1.9] TOPOLOGY_CLASS_PATH")
53
- puts(" redstorm cluster [--1.8|--1.9] TOPOLOGY_CLASS_PATH")
55
+ puts(" redstorm cluster [--1.8|--1.9] [--config STORM_CONFIG_PATH] TOPOLOGY_CLASS_PATH")
54
56
  exit(1)
55
57
  end
56
58
 
59
+ # TODO: refactor args parsing... becoming a mess.
60
+
57
61
  def self.run(args)
58
62
  if args.size > 0
59
63
  if args[0] == "version"
@@ -66,10 +70,11 @@ module RedStorm
66
70
  elsif args.size >= 2 && ["local", "cluster"].include?(args[0])
67
71
  env = args.delete_at(0)
68
72
  version = args.delete("--1.8") || args.delete("--1.9")
73
+ storm_conf = args.delete("--config") ? File.expand_path(args.delete_at(0)) : DEFAULT_STORM_CONF_FILE
69
74
  if args.size == 1
70
75
  file = args[0]
71
76
  load(TASKS_FILE)
72
- Rake::Task['launch'].invoke(env, version, file)
77
+ Rake::Task['launch'].invoke(env, storm_conf, version, file)
73
78
  exit
74
79
  end
75
80
  end
@@ -1,3 +1,3 @@
1
1
  module RedStorm
2
- VERSION = '0.6.6.beta1'
2
+ VERSION = '0.6.6.beta2'
3
3
  end
@@ -12,7 +12,7 @@ require 'red_storm/application'
12
12
 
13
13
  INSTALL_IVY_VERSION = "2.3.0"
14
14
 
15
- task :launch, :env, :ruby_mode, :class_file do |t, args|
15
+ task :launch, :env, :storm_conf, :ruby_mode, :class_file do |t, args|
16
16
  # use ruby mode parameter or default to current interpreter version
17
17
  version_token = RedStorm.jruby_mode_token(args[:ruby_mode])
18
18
 
@@ -24,7 +24,11 @@ task :launch, :env, :ruby_mode, :class_file do |t, args|
24
24
  puts("error: cluster jar file #{TARGET_CLUSTER_JAR} not found. Generate it using $redstorm jar DIR1 [DIR2, ...]")
25
25
  exit(1)
26
26
  end
27
- RedStorm::Application.cluster_storm_command(args[:class_file], args[:ruby_mode])
27
+ unless File.exist?(args[:storm_conf])
28
+ puts("error: Storm config file #{args[:storm_conf]} not found. Create it or supply alternate path using $redstorm cluster --config STORM_CONFIG_PATH ...")
29
+ exit(1)
30
+ end
31
+ RedStorm::Application.cluster_storm_command(args[:storm_conf], args[:class_file], args[:ruby_mode])
28
32
  end
29
33
 
30
34
  puts("launching #{command}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redstorm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6.beta1
4
+ version: 0.6.6.beta2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-02 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec