bumbleworks 0.0.36 → 0.0.37
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/bumbleworks/ruote.rb +11 -3
- data/lib/bumbleworks/version.rb +1 -1
- data/spec/lib/bumbleworks/ruote_spec.rb +43 -1
- metadata +4 -4
data/.gitignore
CHANGED
data/lib/bumbleworks/ruote.rb
CHANGED
@@ -70,12 +70,14 @@ module Bumbleworks
|
|
70
70
|
options[:method] = :cancel
|
71
71
|
end
|
72
72
|
|
73
|
-
|
74
|
-
dashboard.send(options[:method], ps.wfid)
|
75
|
-
end
|
73
|
+
notified_processes = []
|
76
74
|
|
77
75
|
start_time = Time.now
|
78
76
|
while dashboard.processes.count > 0
|
77
|
+
new_processes = dashboard.processes - notified_processes
|
78
|
+
send_cancellation_message(options[:method], new_processes)
|
79
|
+
notified_processes += new_processes
|
80
|
+
|
79
81
|
if (Time.now - start_time) > options[:timeout]
|
80
82
|
error_type = options[:method] == :cancel ? CancelTimeout : KillTimeout
|
81
83
|
raise error_type, "Process #{options[:method]} taking too long - #{dashboard.processes.count} processes remain. Errors: #{dashboard.errors}"
|
@@ -84,6 +86,12 @@ module Bumbleworks
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
89
|
+
def send_cancellation_message(method, processes)
|
90
|
+
processes.each do |ps|
|
91
|
+
dashboard.send(method, ps.wfid)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
87
95
|
def kill_all_processes!(options = {})
|
88
96
|
cancel_all_processes!(options.merge(:method => :kill))
|
89
97
|
end
|
data/lib/bumbleworks/version.rb
CHANGED
@@ -87,6 +87,48 @@ describe Bumbleworks::Ruote do
|
|
87
87
|
Bumbleworks.dashboard.processes.count.should == 0
|
88
88
|
end
|
89
89
|
|
90
|
+
|
91
|
+
it 'cancels processes which show up while waiting' do
|
92
|
+
class Bumbleworks::Ruote
|
93
|
+
class << self
|
94
|
+
alias_method :original, :send_cancellation_message
|
95
|
+
def send_cancellation_message(method, processes)
|
96
|
+
# 2. call original method to cancel the processes kicked off below
|
97
|
+
original(method, processes)
|
98
|
+
|
99
|
+
# 3. launch some more processes before returning, but only do it once.
|
100
|
+
# These should also be cancelled.
|
101
|
+
if !@kicked_off
|
102
|
+
Bumbleworks.define_process "do_more_nothing" do
|
103
|
+
participant :ref => "lazy_guy_bob", :task => 'absolutely_nothing'
|
104
|
+
end
|
105
|
+
|
106
|
+
10.times do
|
107
|
+
Bumbleworks.launch!("do_more_nothing")
|
108
|
+
end
|
109
|
+
@kicked_off = true
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# 1. kick off some processes, wait for them then cancel them.
|
116
|
+
5.times do |i|
|
117
|
+
Bumbleworks.define_process "do_nothing_#{i}" do
|
118
|
+
participant :ref => "lazy_guy_#{i}", :task => 'absolutely_nothing'
|
119
|
+
end
|
120
|
+
Bumbleworks.launch!("do_nothing_#{i}")
|
121
|
+
Bumbleworks.dashboard.wait_for("lazy_guy_#{i}".to_sym)
|
122
|
+
end
|
123
|
+
|
124
|
+
Bumbleworks.dashboard.processes.count.should == 5
|
125
|
+
|
126
|
+
described_class.cancel_all_processes!(:timeout => 30)
|
127
|
+
|
128
|
+
# 4. When this is all done, all processes should be cancelled.
|
129
|
+
Bumbleworks.dashboard.processes.count.should == 0
|
130
|
+
end
|
131
|
+
|
90
132
|
it 'times out if processes are not cancelled in time' do
|
91
133
|
Bumbleworks.define_process "time_hog" do
|
92
134
|
sequence :on_cancel => 'ignore_parents' do
|
@@ -245,4 +287,4 @@ describe Bumbleworks::Ruote do
|
|
245
287
|
described_class.dashboard.participant_list.first.classname.should == 'Bumbleworks::StorageParticipant'
|
246
288
|
end
|
247
289
|
end
|
248
|
-
end
|
290
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumbleworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.37
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-09-
|
15
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruote
|
@@ -236,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
236
|
version: '0'
|
237
237
|
segments:
|
238
238
|
- 0
|
239
|
-
hash:
|
239
|
+
hash: -2225895181847802927
|
240
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
241
|
none: false
|
242
242
|
requirements:
|
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
245
|
version: '0'
|
246
246
|
segments:
|
247
247
|
- 0
|
248
|
-
hash:
|
248
|
+
hash: -2225895181847802927
|
249
249
|
requirements: []
|
250
250
|
rubyforge_project:
|
251
251
|
rubygems_version: 1.8.23
|