minion 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- metadata +1 -6
- data/examples/listen.rb +0 -36
- data/examples/obey.rb +0 -25
- data/examples/pull.rb +0 -41
- data/examples/pull2.rb +0 -41
- data/examples/push.rb +0 -28
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orion Henry
|
@@ -89,11 +89,6 @@ summary: Super simple job queue over AMQP
|
|
89
89
|
test_files:
|
90
90
|
- spec/base.rb
|
91
91
|
- spec/enqueue_spec.rb
|
92
|
-
- examples/listen.rb
|
93
92
|
- examples/math.rb
|
94
|
-
- examples/obey.rb
|
95
|
-
- examples/pull.rb
|
96
|
-
- examples/pull2.rb
|
97
|
-
- examples/push.rb
|
98
93
|
- examples/sandwich.rb
|
99
94
|
- examples/when.rb
|
data/examples/listen.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'minion'
|
6
|
-
require 'activeresource' ## for 1.second
|
7
|
-
|
8
|
-
include Minion
|
9
|
-
|
10
|
-
error do |exception,queue,message,headers|
|
11
|
-
puts "got an error processing queue #{queue}"
|
12
|
-
puts exception.message
|
13
|
-
puts exception.backtrace
|
14
|
-
end
|
15
|
-
|
16
|
-
logger do |msg|
|
17
|
-
puts "--> #{msg}"
|
18
|
-
end
|
19
|
-
|
20
|
-
every 1.second do
|
21
|
-
announce "message.1", :foo => :bar
|
22
|
-
end
|
23
|
-
|
24
|
-
listen "message.1" do |args|
|
25
|
-
puts self.class
|
26
|
-
foobar
|
27
|
-
log "I received message.1 (and so did all other minions listening in)"
|
28
|
-
log "args were #{args}"
|
29
|
-
Minion.stop
|
30
|
-
end
|
31
|
-
|
32
|
-
listen "message.2" do |args|
|
33
|
-
log "I will not receive message.2"
|
34
|
-
end
|
35
|
-
|
36
|
-
## problem - this is ideal for large data transport (where as the other kind isnt)
|
data/examples/obey.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'minion'
|
6
|
-
require 'activeresource' ## for 1.second
|
7
|
-
|
8
|
-
include Minion
|
9
|
-
|
10
|
-
error do |exception,queue,message,headers|
|
11
|
-
puts "got an error processing queue #{queue}"
|
12
|
-
puts exception.message
|
13
|
-
puts exception.backtrace
|
14
|
-
end
|
15
|
-
|
16
|
-
logger do |msg|
|
17
|
-
puts "--> #{msg}"
|
18
|
-
end
|
19
|
-
|
20
|
-
Minion.decree "app_id.down", :zone => 1, :stack => "bamboo"
|
21
|
-
|
22
|
-
obey "app_id.down", :zone => 1, :stack => "bamboo" do
|
23
|
-
# something
|
24
|
-
end
|
25
|
-
|
data/examples/pull.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'minion'
|
6
|
-
require 'activeresource'
|
7
|
-
|
8
|
-
include Minion
|
9
|
-
|
10
|
-
logger do |msg|
|
11
|
-
# puts "--> #{msg}"
|
12
|
-
end
|
13
|
-
|
14
|
-
tick = 100
|
15
|
-
span = 1..10
|
16
|
-
|
17
|
-
tasks = span.map { |i| "task.#{i}" }
|
18
|
-
base_data = { :time => Time.now, :type => "thing", :size => 123, :format => "octet/stream", :event_id => "0000000000000000000000000000000000000000000000000000" }
|
19
|
-
|
20
|
-
counter = 0
|
21
|
-
tasks.each do |task|
|
22
|
-
obey task, :type => "thing" do |args|
|
23
|
-
counter+=1
|
24
|
-
if counter % tick == 0
|
25
|
-
print "."
|
26
|
-
$stdout.flush
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
delay 1.second do
|
32
|
-
puts "go!!"
|
33
|
-
Minion.decree "start", {}
|
34
|
-
end
|
35
|
-
|
36
|
-
obey "done" do |args|
|
37
|
-
puts ""
|
38
|
-
puts "All done"
|
39
|
-
Minion.stop
|
40
|
-
end
|
41
|
-
|
data/examples/pull2.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'minion'
|
6
|
-
require 'activeresource'
|
7
|
-
|
8
|
-
include Minion
|
9
|
-
|
10
|
-
logger do |msg|
|
11
|
-
# puts "--> #{msg}"
|
12
|
-
end
|
13
|
-
|
14
|
-
tick = 100
|
15
|
-
span = 1..10
|
16
|
-
|
17
|
-
tasks = span.map { |i| "task.#{i}" }
|
18
|
-
base_data = { :time => Time.now, :type => "thing", :size => 123, :format => "octet/stream", :event_id => "0000000000000000000000000000000000000000000000000000" }
|
19
|
-
|
20
|
-
counter = 0
|
21
|
-
tasks.each do |task|
|
22
|
-
obey task, :type => "thing" do |args|
|
23
|
-
counter+=1
|
24
|
-
if counter % tick == 0
|
25
|
-
print "."
|
26
|
-
$stdout.flush
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
#delay 1.second do
|
32
|
-
# puts "go!!"
|
33
|
-
# Minion.decree "start", {}
|
34
|
-
#end
|
35
|
-
|
36
|
-
obey "done" do |args|
|
37
|
-
puts ""
|
38
|
-
puts "All done"
|
39
|
-
Minion.stop
|
40
|
-
end
|
41
|
-
|
data/examples/push.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
-
require 'rubygems'
|
5
|
-
require 'minion'
|
6
|
-
|
7
|
-
include Minion
|
8
|
-
|
9
|
-
logger do |msg|
|
10
|
-
# puts "--> #{msg}"
|
11
|
-
end
|
12
|
-
|
13
|
-
count = 20000
|
14
|
-
span = 1..10
|
15
|
-
tasks = span.map { |i| "task.#{i}" }
|
16
|
-
base_data = { :type => "thing", :size => 123, :format => "octet/stream", :event_id => "0000000000000000000000000000000000000000000000000000" }
|
17
|
-
|
18
|
-
obey "start" do
|
19
|
-
puts "starting!"
|
20
|
-
count.times do
|
21
|
-
task = tasks[rand(tasks.size)]
|
22
|
-
Minion.decree task, base_data
|
23
|
-
end
|
24
|
-
Minion.decree "done", {}
|
25
|
-
end
|
26
|
-
|
27
|
-
#Minion.announce task, base_data
|
28
|
-
|