visfleet-pipeline_toolkit 0.0.1
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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +56 -0
- data/bin/monitor.rb +11 -0
- data/bin/pop.rb +21 -0
- data/bin/push.rb +25 -0
- data/bin/subscribe.rb +23 -0
- data/perf_test/test_pop.rb +32 -0
- data/perf_test/test_pop_async.rb +24 -0
- data/perf_test/test_push.rb +27 -0
- metadata +65 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Aisha Fenton
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "pipeline_toolkit"
|
8
|
+
gem.summary = %Q{TODO}
|
9
|
+
gem.email = "aisha.fenton@visfleet.com"
|
10
|
+
gem.homepage = "http://github.com/visfleet/pipeline_toolkit"
|
11
|
+
gem.authors = ["Aisha Fenton"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |test|
|
29
|
+
test.libs << 'test'
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
if File.exist?('VERSION.yml')
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
47
|
+
else
|
48
|
+
version = ""
|
49
|
+
end
|
50
|
+
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
52
|
+
rdoc.title = "pipeline_toolkit #{version}"
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|
data/bin/monitor.rb
ADDED
data/bin/pop.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'trollop'
|
5
|
+
require 'pipeline_toolkit'
|
6
|
+
require "pp"
|
7
|
+
|
8
|
+
opts = Trollop::options do
|
9
|
+
opt :sources, "Sources", :short => "s", :type => :strings
|
10
|
+
opt :cycle, "Seconds between polls", :default => 1
|
11
|
+
opt :ack, "Switch that requires that messages are successfully processed before continuing with the next message", :short => "a"
|
12
|
+
|
13
|
+
# Msg server
|
14
|
+
opt :host, "The AMQP message server host", :default => "localhost"
|
15
|
+
opt :port, "The AMQP message server port", :default => "5672"
|
16
|
+
opt :user, "The AMQP message server username", :default => "guest"
|
17
|
+
opt :pass, "The AMQP message server username", :default => "guest", :short => "w"
|
18
|
+
opt :vhost, "The AMQP message server vhost", :default => "/"
|
19
|
+
end
|
20
|
+
|
21
|
+
MessagePopper.new(opts).start
|
data/bin/push.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'trollop'
|
5
|
+
require 'pipeline_toolkit'
|
6
|
+
|
7
|
+
opts = Trollop::options do
|
8
|
+
opt :destinations, "Destinations", :short => "d", :type => :strings
|
9
|
+
opt :route_eval, "A string of ruby code that ", :short => "e", :type => :string
|
10
|
+
opt :route_file, "A string of ruby code that ", :short => "f", :type => :string
|
11
|
+
|
12
|
+
# Msg server
|
13
|
+
opt :host, "The AMQP message server host", :default => "localhost"
|
14
|
+
opt :port, "The AMQP message server port", :default => "5672"
|
15
|
+
opt :user, "The AMQP message server username", :default => "guest"
|
16
|
+
opt :pass, "The AMQP message server username", :default => "guest"
|
17
|
+
opt :vhost, "The AMQP message server vhost", :default => "/"
|
18
|
+
end
|
19
|
+
|
20
|
+
MessagePusher.new(opts).start
|
21
|
+
|
22
|
+
# pop -s raw | thingie | push -d my_queue
|
23
|
+
# pop -s raw | thingie | push -f "(msg.tmu_id.hash % NUMBER_OF_FORKS).to_s"
|
24
|
+
# pop -s raw | thingie | push -f "Socket.gethostname"
|
25
|
+
# pop -s raw | thingie | push -f "require route_to_site"
|
data/bin/subscribe.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'trollop'
|
5
|
+
require 'pipeline_toolkit'
|
6
|
+
|
7
|
+
opts = Trollop::options do
|
8
|
+
opt :sources, "Sources", :short => "s", :type => :strings
|
9
|
+
opt :ack, "Switch that requires that messages are successfully processed before continuing with the next message", :short => "a"
|
10
|
+
opt :queue_name, "The name that the created queue is given", :short => "q", :type => :string
|
11
|
+
|
12
|
+
# Msg server
|
13
|
+
opt :host, "The AMQP message server host", :default => "localhost"
|
14
|
+
opt :port, "The AMQP message server port", :default => "5672"
|
15
|
+
opt :user, "The AMQP message server username", :default => "guest"
|
16
|
+
opt :pass, "The AMQP message server username", :default => "guest", :short => "w"
|
17
|
+
opt :vhost, "The AMQP message server vhost", :default => "/"
|
18
|
+
end
|
19
|
+
|
20
|
+
ms = MessageSubscriber.new(opts)
|
21
|
+
Signal.trap('INT') { ms.stop }
|
22
|
+
Signal.trap('TERM'){ ms.stop }
|
23
|
+
ms.start
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bunny"
|
3
|
+
|
4
|
+
@msg_server = Bunny.new(:spec => '08')
|
5
|
+
@msg_server.start
|
6
|
+
|
7
|
+
def start
|
8
|
+
count ||= 0
|
9
|
+
prev_time ||= Time.now
|
10
|
+
queue = @msg_server.queue("process_telemetry")
|
11
|
+
|
12
|
+
loop do
|
13
|
+
result = queue.pop
|
14
|
+
next if result == :queue_empty
|
15
|
+
|
16
|
+
count += 1
|
17
|
+
if count > 100
|
18
|
+
t = Time.now
|
19
|
+
puts("msgs pops per sec: #{count / (t - prev_time)}")
|
20
|
+
prev_time = t
|
21
|
+
count = 0
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
start()
|
29
|
+
ensure
|
30
|
+
puts "stopping"
|
31
|
+
@msg_server.stop
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require 'mq'
|
3
|
+
|
4
|
+
Signal.trap('INT') { AMQP.stop{ EM.stop } }
|
5
|
+
Signal.trap('TERM'){ AMQP.stop{ EM.stop } }
|
6
|
+
|
7
|
+
count ||= 0
|
8
|
+
prev_time ||= Time.now
|
9
|
+
|
10
|
+
AMQP.start(:host => 'localhost') do
|
11
|
+
|
12
|
+
MQ.queue('process_telemetry').subscribe(:ack => false) do |headers, body|
|
13
|
+
|
14
|
+
count += 1
|
15
|
+
if count > 100
|
16
|
+
t = Time.now
|
17
|
+
puts("msgs pops per sec: #{count / (t - prev_time)}")
|
18
|
+
prev_time = t
|
19
|
+
count = 0
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bunny"
|
3
|
+
|
4
|
+
EXCHANGE = "raw_telemetry"
|
5
|
+
QUEUE = "process_telemetry"
|
6
|
+
|
7
|
+
count ||= 0
|
8
|
+
prev_time ||= Time.now
|
9
|
+
msg_server = Bunny.new(:spec => '08')
|
10
|
+
msg_server.start
|
11
|
+
|
12
|
+
ex = msg_server.exchange(EXCHANGE, :type => :fanout)
|
13
|
+
msg_server.queue(QUEUE).bind(EXCHANGE)
|
14
|
+
|
15
|
+
loop do
|
16
|
+
|
17
|
+
ex.publish("This is my msg")
|
18
|
+
|
19
|
+
count += 1
|
20
|
+
if count > 100
|
21
|
+
t = Time.now
|
22
|
+
puts("msgs pushes per sec: #{count / (t - prev_time)}")
|
23
|
+
prev_time = t
|
24
|
+
count = 0
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: visfleet-pipeline_toolkit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aisha Fenton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-09 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: labs@visfleet.com
|
18
|
+
executables:
|
19
|
+
- monitor.rb
|
20
|
+
- subscribe.rb
|
21
|
+
- push.rb
|
22
|
+
- pop.rb
|
23
|
+
extensions: []
|
24
|
+
|
25
|
+
extra_rdoc_files:
|
26
|
+
- LICENSE
|
27
|
+
- README.rdoc
|
28
|
+
files:
|
29
|
+
- .document
|
30
|
+
- .gitignore
|
31
|
+
- LICENSE
|
32
|
+
- README.rdoc
|
33
|
+
- Rakefile
|
34
|
+
- perf_test/test_pop.rb
|
35
|
+
- perf_test/test_pop_async.rb
|
36
|
+
- perf_test/test_push.rb
|
37
|
+
has_rdoc: false
|
38
|
+
homepage: http://github.com/visfleet/pipeline_toolkit
|
39
|
+
licenses:
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --charset=UTF-8
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.5
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Toolkit for building processing pipelines using Unix Pipes and AMQP messages
|
64
|
+
test_files: []
|
65
|
+
|