zillabyte 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ruby/lib/zillabyte/harness/app.rb +7 -2
- data/ruby/lib/zillabyte/harness/component.rb +7 -2
- data/ruby/lib/zillabyte/harness/each.rb +5 -7
- data/ruby/lib/zillabyte/harness/filter.rb +2 -4
- data/ruby/lib/zillabyte/harness/group_by.rb +2 -4
- data/ruby/lib/zillabyte/harness/helper.rb +25 -4
- data/ruby/lib/zillabyte/harness/live_delegator.rb +34 -14
- data/ruby/lib/zillabyte/harness/sink.rb +1 -1
- data/ruby/lib/zillabyte/harness/source.rb +1 -3
- data/ruby/lib/zillabyte/harness/stream_builder.rb +26 -0
- data/ruby/lib/zillabyte/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1c3f711f2335104c92ae34197b9a4875f77b8c4
|
4
|
+
data.tar.gz: d968fdd0541084622825e66b6b72e1f210dfe77e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daa7cef41dadd69a037d170aef8f4e593a0c85c1753748bc08ee10695fa85ede52fd67c791035a17db161bebd60f0453c3729e7ba60f2a4186fab3b11acd5c0e
|
7
|
+
data.tar.gz: c3822486731d90c2237ce428901e4606d65cf9f15ae393d6c3fcb83db0c03f689478fd80b6be945630e5d2ad4b03b77d5aaae72fdb2432568cb72f289d439096
|
@@ -9,7 +9,11 @@ class Zillabyte::Harness::App < Zillabyte::Harness::Base
|
|
9
9
|
Zillabyte::Harness::Helper.check_name("app", h._name, {})
|
10
10
|
h._options = Zillabyte::Harness::Helper.opt_parser()
|
11
11
|
if(h._options[:command] == :info)
|
12
|
-
|
12
|
+
if h._options[:host]
|
13
|
+
h._socket = TCPSocket.new(h._options[:host], h._options[:port])
|
14
|
+
elsif h._options[:unix_socket]
|
15
|
+
h._socket = UNIXSocket.new(h._options[:unix_socket])
|
16
|
+
end
|
13
17
|
info_hash = {"language" => "ruby", "name" => h._name, "flow_type" => "app", "multilang_version" => Zillabyte::VERSION}
|
14
18
|
Zillabyte::Harness::Helper.write_hash_to_file(info_hash, h._socket)
|
15
19
|
end
|
@@ -18,10 +22,11 @@ class Zillabyte::Harness::App < Zillabyte::Harness::Base
|
|
18
22
|
|
19
23
|
def source(*args, &block)
|
20
24
|
op = Zillabyte::Harness::OperationHandler.new(self, Zillabyte::Harness::Stream)
|
21
|
-
op.build_multilang_operation("source", *args, &block)
|
25
|
+
stream = op.build_multilang_operation("source", *args, &block)
|
22
26
|
.add_operation_properties_to_info(:name, :type)
|
23
27
|
.add_optional_operation_properties_to_info(:relation, :matches, :end_cycle_policy)
|
24
28
|
.handle_operation
|
25
29
|
.get_output_streams
|
30
|
+
return Zillabyte::Harness::StreamBuilder.new(stream)
|
26
31
|
end
|
27
32
|
end
|
@@ -8,7 +8,11 @@ class Zillabyte::Harness::Component < Zillabyte::Harness::Base
|
|
8
8
|
Zillabyte::Harness::Helper.check_name("component", h._name, {})
|
9
9
|
h._options = Zillabyte::Harness::Helper.opt_parser()
|
10
10
|
if(h._options[:command] == :info)
|
11
|
-
|
11
|
+
if h._options[:host]
|
12
|
+
h._socket = TCPSocket.new(h._options[:host], h._options[:port])
|
13
|
+
elsif h._options[:unix_socket]
|
14
|
+
h._socket = UNIXSocket.new(h._options[:unix_socket])
|
15
|
+
end
|
12
16
|
info_hash = {"language" => "ruby", "name" => h._name, "flow_type" => "component", "multilang_version" => Zillabyte::VERSION}
|
13
17
|
Zillabyte::Harness::Helper.write_hash_to_file(info_hash, h._socket)
|
14
18
|
end
|
@@ -17,9 +21,10 @@ class Zillabyte::Harness::Component < Zillabyte::Harness::Base
|
|
17
21
|
|
18
22
|
def inputs(*args, &block)
|
19
23
|
op = Zillabyte::Harness::OperationHandler.new(self, Zillabyte::Harness::ComponentStream)
|
20
|
-
op.build_multilang_operation("component_input", *args, &block)
|
24
|
+
stream = op.build_multilang_operation("component_input", *args, &block)
|
21
25
|
.add_operation_properties_to_info(:name, :type, :fields)
|
22
26
|
.handle_operation
|
23
27
|
.get_output_streams
|
28
|
+
return Zillabyte::Harness::StreamBuilder.new(stream)
|
24
29
|
end
|
25
30
|
end
|
@@ -54,8 +54,8 @@ class Zillabyte::Harness::Each
|
|
54
54
|
class Node < Zillabyte::Harness::CommonNode
|
55
55
|
attr_accessor :_output_format, :_execute
|
56
56
|
|
57
|
-
def initialize()
|
58
|
-
@_name = "each_"+Zillabyte::Harness::Counter.get()
|
57
|
+
def initialize(*args)
|
58
|
+
@_name = args[0] || "each_"+Zillabyte::Harness::Counter.get()
|
59
59
|
@_type = "each"
|
60
60
|
@_output_format = :replace
|
61
61
|
end
|
@@ -71,11 +71,11 @@ class Zillabyte::Harness::Each
|
|
71
71
|
|
72
72
|
def initialize(app, *args)
|
73
73
|
@_app = app
|
74
|
-
@_options = Zillabyte::Harness::Helper.
|
74
|
+
@_vector_options, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
75
75
|
end
|
76
76
|
|
77
77
|
def build_node(&block)
|
78
|
-
@_node = Node.new
|
78
|
+
@_node = Node.new(*@_vector_options)
|
79
79
|
# Does the block take 0 arguments? If so it's not just an execute block.
|
80
80
|
if(block.arity == 0)
|
81
81
|
@_node.instance_eval(&block)
|
@@ -95,9 +95,7 @@ class Zillabyte::Harness::Each
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def run_operation
|
98
|
-
host = @_app._options[:host]
|
99
|
-
port = @_app._options[:port]
|
100
98
|
c = Zillabyte::Harness::EachController.new(@_node, Zillabyte::Common::Progress.new)
|
101
|
-
c.run(
|
99
|
+
c.run(@_app._options)
|
102
100
|
end
|
103
101
|
end
|
@@ -51,7 +51,7 @@ class Zillabyte::Harness::Filter
|
|
51
51
|
|
52
52
|
def initialize(app, *args)
|
53
53
|
@_app = app
|
54
|
-
@_options = Zillabyte::Harness::Helper.
|
54
|
+
@_vector_options, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
55
55
|
end
|
56
56
|
|
57
57
|
def build_node(&block)
|
@@ -75,10 +75,8 @@ class Zillabyte::Harness::Filter
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def run_operation
|
78
|
-
host = @_app._options[:host]
|
79
|
-
port = @_app._options[:port]
|
80
78
|
c = Zillabyte::Harness::FilterController.new(@_node, Zillabyte::Common::Progress.new)
|
81
|
-
c.run(
|
79
|
+
c.run(@_app._options)
|
82
80
|
end
|
83
81
|
|
84
82
|
end
|
@@ -65,7 +65,7 @@ class Zillabyte::Harness::GroupBy
|
|
65
65
|
def initialize(app, *args)
|
66
66
|
@_app = app
|
67
67
|
@_fields = Zillabyte::Harness::Helper.get_non_option_args(args)
|
68
|
-
@_options = Zillabyte::Harness::Helper.
|
68
|
+
@_vector_options, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
69
69
|
end
|
70
70
|
|
71
71
|
def build_node(&block)
|
@@ -86,9 +86,7 @@ class Zillabyte::Harness::GroupBy
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def run_operation
|
89
|
-
host = @_app._options[:host]
|
90
|
-
port = @_app._options[:port]
|
91
89
|
c = Zillabyte::Harness::GroupByController.new(@_node, Zillabyte::Common::Progress.new)
|
92
|
-
c.run(
|
90
|
+
c.run(@_app._options)
|
93
91
|
end
|
94
92
|
end
|
@@ -27,6 +27,9 @@ class Zillabyte::Harness::Helper
|
|
27
27
|
opts.on("--port PORT") do |v|
|
28
28
|
options[:port] = v
|
29
29
|
end
|
30
|
+
opts.on("--unix_socket PATH") do |v|
|
31
|
+
options[:unix_socket] = v
|
32
|
+
end
|
30
33
|
opts.on("--file FNAME") do |v|
|
31
34
|
options[:file] = v
|
32
35
|
end
|
@@ -421,12 +424,30 @@ class Zillabyte::Harness::Helper
|
|
421
424
|
return args
|
422
425
|
end
|
423
426
|
end
|
424
|
-
|
425
|
-
|
427
|
+
|
428
|
+
|
429
|
+
# This is meant to consume an variable list of args, and return the vector part, as
|
430
|
+
# well as the options part. For example, consider these methods:
|
431
|
+
#
|
432
|
+
# foo1('bar', 'baz', :owner => 'bam')
|
433
|
+
# foo2(:name => 'bar', :type => 'baz', :owner => 'bam')
|
434
|
+
#
|
435
|
+
# Taking the *args of the former (foo1) and giving it to `get_vector_and_hashes`
|
436
|
+
# will result in:
|
437
|
+
#
|
438
|
+
# [ ['bar', 'baz'], {:type => 'baz}]
|
439
|
+
#
|
440
|
+
# The latter (foo2) will yield:
|
441
|
+
#
|
442
|
+
# [ [], {:type => 'baz', :owner => 'bam', :name => 'bar'}]
|
443
|
+
#
|
444
|
+
# i.e. this method makes it easier to deal with vector-based params, as well as hash
|
445
|
+
# params.
|
446
|
+
def self.get_vector_and_hashes(args)
|
426
447
|
if args.last.is_a?(Hash)
|
427
|
-
return args.last
|
448
|
+
return [args[0..-2], args.last]
|
428
449
|
else
|
429
|
-
return {}
|
450
|
+
return [args, {}]
|
430
451
|
end
|
431
452
|
end
|
432
453
|
|
@@ -18,13 +18,17 @@ module Zillabyte
|
|
18
18
|
DEATH_TIMEOUT = READ_SOFT_TIMEOUT * 6 # If no activity from the parent (even response to a ping) time before we kill ourself.
|
19
19
|
|
20
20
|
class << self
|
21
|
-
attr_accessor :mode, :emits, :end_cycle_policy, :pending_commands, :host, :port, :socket
|
21
|
+
attr_accessor :mode, :emits, :end_cycle_policy, :pending_commands, :host, :port, :unix_socket, :socket
|
22
22
|
end
|
23
23
|
|
24
24
|
self.pending_commands = []
|
25
25
|
|
26
26
|
def setup_pipes
|
27
|
-
|
27
|
+
if Storm::Protocol.unix_socket
|
28
|
+
Storm::Protocol.socket = UNIXSocket.open(Storm::Protocol.unix_socket)
|
29
|
+
else
|
30
|
+
Storm::Protocol.socket = TCPSocket.open(Storm::Protocol.host || "0.0.0.0", Storm::Protocol.port)
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
def read_message
|
@@ -207,10 +211,14 @@ module Zillabyte
|
|
207
211
|
|
208
212
|
def ack(id); end
|
209
213
|
|
210
|
-
def run(
|
214
|
+
def run(options)
|
211
215
|
Storm::Protocol.mode = 'source'
|
212
|
-
|
213
|
-
|
216
|
+
if (options[:host])
|
217
|
+
Storm::Protocol.host = options[:host]
|
218
|
+
Storm::Protocol.port = options[:port]
|
219
|
+
elsif (options[:unix_socket])
|
220
|
+
Storm::Protocol.unix_socket = options[:unix_socket]
|
221
|
+
end
|
214
222
|
setup_pipes
|
215
223
|
handshake
|
216
224
|
|
@@ -251,10 +259,14 @@ module Zillabyte
|
|
251
259
|
|
252
260
|
def execute(tuple); end
|
253
261
|
|
254
|
-
def run(
|
262
|
+
def run(options)
|
255
263
|
Storm::Protocol.mode = 'each'
|
256
|
-
|
257
|
-
|
264
|
+
if (options[:host])
|
265
|
+
Storm::Protocol.host = options[:host]
|
266
|
+
Storm::Protocol.port = options[:port]
|
267
|
+
elsif (options[:unix_socket])
|
268
|
+
Storm::Protocol.unix_socket = options[:unix_socket]
|
269
|
+
end
|
258
270
|
setup_pipes
|
259
271
|
handshake
|
260
272
|
|
@@ -291,10 +303,14 @@ module Zillabyte
|
|
291
303
|
|
292
304
|
def keep(tuple); end
|
293
305
|
|
294
|
-
def run(
|
306
|
+
def run(options)
|
295
307
|
Storm::Protocol.mode = 'filter'
|
296
|
-
|
297
|
-
|
308
|
+
if (options[:host])
|
309
|
+
Storm::Protocol.host = options[:host]
|
310
|
+
Storm::Protocol.port = options[:port]
|
311
|
+
elsif (options[:unix_socket])
|
312
|
+
Storm::Protocol.unix_socket = options[:unix_socket]
|
313
|
+
end
|
298
314
|
setup_pipes
|
299
315
|
handshake
|
300
316
|
|
@@ -325,10 +341,14 @@ module Zillabyte
|
|
325
341
|
class GroupBy
|
326
342
|
include Storm::Protocol
|
327
343
|
|
328
|
-
def run(
|
344
|
+
def run(options)
|
329
345
|
Storm::Protocol.mode = 'group_by'
|
330
|
-
|
331
|
-
|
346
|
+
if (options[:host])
|
347
|
+
Storm::Protocol.host = options[:host]
|
348
|
+
Storm::Protocol.port = options[:port]
|
349
|
+
elsif (options[:unix_socket])
|
350
|
+
Storm::Protocol.unix_socket = options[:unix_socket]
|
351
|
+
end
|
332
352
|
setup_pipes
|
333
353
|
handshake
|
334
354
|
|
@@ -52,7 +52,7 @@ class Zillabyte::Harness::Sink
|
|
52
52
|
|
53
53
|
def initialize(app, *args)
|
54
54
|
@_app = app
|
55
|
-
@_options = Zillabyte::Harness::Helper.
|
55
|
+
@_vector_options, @_options = Zillabyte::Harness::Helper.get_vector_and_hashes(args)
|
56
56
|
end
|
57
57
|
|
58
58
|
def build_node(&block)
|
@@ -120,9 +120,7 @@ class Zillabyte::Harness::Source
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def run_operation
|
123
|
-
host = @_app._options[:host]
|
124
|
-
port = @_app._options[:port]
|
125
123
|
c = Zillabyte::Harness::SourceController.new(@_node, Zillabyte::Common::Progress.new)
|
126
|
-
c.run(
|
124
|
+
c.run(@_app._options)
|
127
125
|
end
|
128
126
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Zillabyte::Harness::StreamBuilder < Array
|
2
|
+
attr_accessor :_name, :_app, :_previous_node_name
|
3
|
+
|
4
|
+
def initialize(first_stream)
|
5
|
+
@_streams = [first_stream]
|
6
|
+
self.clear()
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
# Ruby magic to automatically call 'method_name' on the last stream we collected
|
11
|
+
def method_missing(method_name, *args, &block)
|
12
|
+
results = @_streams.last.send method_name, *args, &block
|
13
|
+
if results.is_a?(Array)
|
14
|
+
# Split stream...
|
15
|
+
results.each_with_index do |v, i|
|
16
|
+
self[i] = v
|
17
|
+
end
|
18
|
+
else
|
19
|
+
# Continue this stream...
|
20
|
+
@_streams << results
|
21
|
+
self.clear()
|
22
|
+
end
|
23
|
+
return self
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zillabyte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zillabyte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.
|
40
|
+
version: 0.9.3
|
41
41
|
description: The Official Zillabyte Gem
|
42
42
|
email:
|
43
43
|
- gem@zillabyte.com
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- ruby/lib/zillabyte/harness/sink.rb
|
70
70
|
- ruby/lib/zillabyte/harness/source.rb
|
71
71
|
- ruby/lib/zillabyte/harness/stream.rb
|
72
|
+
- ruby/lib/zillabyte/harness/stream_builder.rb
|
72
73
|
- ruby/lib/zillabyte/harness/tuple.rb
|
73
74
|
- ruby/lib/zillabyte/version.rb
|
74
75
|
homepage: http://www.zillabyte.com
|