bumbleworks 0.0.58 → 0.0.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,8 +51,8 @@ module Bumbleworks
51
51
  options[:method] = :cancel
52
52
  end
53
53
 
54
- if options[:method] == :cancel
55
- dashboard.cancel(wfid)
54
+ if options[:method] == :cancel || !options[:force]
55
+ dashboard.send(options[:method], wfid)
56
56
  else
57
57
  storage.remove_process(wfid)
58
58
  end
@@ -82,7 +82,7 @@ module Bumbleworks
82
82
  start_time = Time.now
83
83
  while dashboard.process_wfids.count > 0
84
84
  new_process_wfids = dashboard.process_wfids - notified_process_wfids
85
- if options[:method] == :cancel
85
+ if options[:method] == :cancel || !options[:force]
86
86
  send_cancellation_message(options[:method], new_process_wfids)
87
87
  else
88
88
  storage.clear
@@ -99,11 +99,7 @@ module Bumbleworks
99
99
 
100
100
  def send_cancellation_message(method, process_wfids)
101
101
  process_wfids.each do |wfid|
102
- if method == :cancel
103
- dashboard.cancel(wfid)
104
- else
105
- storage.remove_process(wfid)
106
- end
102
+ dashboard.send(method, wfid)
107
103
  end
108
104
  end
109
105
 
@@ -1,3 +1,3 @@
1
1
  module Bumbleworks
2
- VERSION = "0.0.58"
2
+ VERSION = "0.0.59"
3
3
  end
@@ -65,6 +65,12 @@ describe Bumbleworks::Ruote do
65
65
  described_class.kill_process!('woot', :timeout => 0.5)
66
66
  }.to raise_error(Bumbleworks::Ruote::KillTimeout)
67
67
  end
68
+
69
+ it 'uses storage.remove_process if force option is true' do
70
+ Bumbleworks.dashboard.storage.should_receive(:remove_process).with('woot')
71
+ Bumbleworks.dashboard.stub(:process).with('woot').and_return(nil)
72
+ described_class.kill_process!('woot', :force => true)
73
+ end
68
74
  end
69
75
 
70
76
  describe ".cancel_all_processes!" do
@@ -176,6 +182,12 @@ describe Bumbleworks::Ruote do
176
182
  described_class.kill_all_processes!(:timeout => 0.5)
177
183
  }.to raise_error(Bumbleworks::Ruote::KillTimeout)
178
184
  end
185
+
186
+ it 'uses storage.clear if force option is true' do
187
+ Bumbleworks.dashboard.stub(:process_wfids).and_return(['wfid'], [])
188
+ Bumbleworks.dashboard.storage.should_receive(:clear)
189
+ described_class.kill_all_processes!(:force => true)
190
+ end
179
191
  end
180
192
 
181
193
  describe '.send_cancellation_message' do
@@ -185,9 +197,9 @@ describe Bumbleworks::Ruote do
185
197
  described_class.send_cancellation_message(:cancel, ['wfid1', 'wfid2'])
186
198
  end
187
199
 
188
- it 'removes given processes from storage if method is kill' do
189
- Bumbleworks.dashboard.storage.should_receive(:remove_process).with('wfid1')
190
- Bumbleworks.dashboard.storage.should_receive(:remove_process).with('wfid2')
200
+ it 'sends kill message to given wfids if method is kill' do
201
+ Bumbleworks.dashboard.should_receive(:kill).with('wfid1')
202
+ Bumbleworks.dashboard.should_receive(:kill).with('wfid2')
191
203
  described_class.send_cancellation_message(:kill, ['wfid1', 'wfid2'])
192
204
  end
193
205
  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.58
4
+ version: 0.0.59
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -262,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
262
  version: '0'
263
263
  segments:
264
264
  - 0
265
- hash: 1107263111673014541
265
+ hash: -849036903259587551
266
266
  required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  none: false
268
268
  requirements:
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  segments:
273
273
  - 0
274
- hash: 1107263111673014541
274
+ hash: -849036903259587551
275
275
  requirements: []
276
276
  rubyforge_project:
277
277
  rubygems_version: 1.8.23