dynflow 0.8.34 → 0.8.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7ff5e3fce545cac6d1d299717c2fa11b54ba9ef6
4
- data.tar.gz: 90214fe9c441dfae1780f591cca27de7eaa89da3
2
+ SHA256:
3
+ metadata.gz: 290e1bf999cae6f5ced255f29c2b62bc5d1fb53d75a0184ca514afbd3deb9c04
4
+ data.tar.gz: 7e4bdad4c493342902070fa5f694569ff3cd1906c648bc403b47dccb03654646
5
5
  SHA512:
6
- metadata.gz: e1084dc1ef5c5d8d923df3fc92d93b1b6e92edd85d29ab4fd5fe045908315a692b2cbf62615d0d34aedbf18b077d522b9eff4b368944c31c5689d1f8484820d2
7
- data.tar.gz: eb449ff93ccc6720e13a4cc539dbec6a1296a4d81d58b3a4129a2ef8530fae769c0a68fe870317d0775fe094919de460d4c719c5bcc2a1318ee3b7939c90a9d7
6
+ metadata.gz: 50250e41adda66f5f8069378d916fa1a58771076420806aa9185bbd2467a36acb038aeda64f3d7757c43801796c2507e23e062307bb40e9fd5ddaed18c0a5236
7
+ data.tar.gz: 0aeae17937111257652845446f8ea5726d735651a57dd3d915f74e943a785566eb9340b5e1356e45bac86c2fe15033dff2e6b8fab50ae17aa05abe2bc32e4749
@@ -58,7 +58,7 @@ module Dynflow
58
58
 
59
59
  # The same logic as in Action::WithSubPlans, but calculated using the expected total count
60
60
  def run_progress
61
- if counts_set?
61
+ if counts_set? && total_count > 0
62
62
  sum = output.values_at(:success_count, :cancelled_count, :failed_count).reduce(:+)
63
63
  sum.to_f / total_count
64
64
  else
@@ -38,7 +38,8 @@ module Dynflow
38
38
  def with_error_handling(error_retval = nil, &block)
39
39
  block.call
40
40
  rescue Exception => e
41
- @logger.fatal e.backtrace.join("\n")
41
+ @logger.warn e.message
42
+ @logger.debug e.backtrace.join("\n")
42
43
  error_retval
43
44
  end
44
45
 
@@ -154,11 +154,19 @@ module Dynflow
154
154
  @started_at ||= start
155
155
  block.call
156
156
  ensure
157
- @progress_done, @progress_weight = action.calculated_progress
157
+ calculate_progress(action)
158
158
  @ended_at = Time.now
159
159
  @execution_time += @ended_at - start
160
160
  @real_time = @ended_at - @started_at
161
161
  end
162
+
163
+ def calculate_progress(action)
164
+ @progress_done, @progress_weight = action.calculated_progress
165
+ if @progress_done.is_a?(Float) && !@progress_done.finite?
166
+ action_logger.error("Unexpected progress value #{@progress_done} for step #{execution_plan_id}##{id}")
167
+ @progress_done = 0
168
+ end
169
+ end
162
170
  end
163
171
  end
164
172
  end
@@ -1,3 +1,3 @@
1
1
  module Dynflow
2
- VERSION = '0.8.34'
2
+ VERSION = '0.8.35'
3
3
  end
data/test/action_test.rb CHANGED
@@ -619,6 +619,7 @@ module Dynflow
619
619
 
620
620
  describe ::Dynflow::Action::WithPollingSubPlans do
621
621
  include TestHelpers
622
+ include Testing
622
623
 
623
624
  let(:clock) { Dynflow::Testing::ManagedClock.new }
624
625
 
@@ -627,8 +628,8 @@ module Dynflow
627
628
  total = 2
628
629
  plan = world.plan(PollingParentAction, count: total)
629
630
  plan.state.must_equal :planned
630
- world.execute(plan.id)
631
631
  clock.pending_pings.count.must_equal 0
632
+ world.execute(plan.id)
632
633
  wait_for do
633
634
  plan.sub_plans_count == total &&
634
635
  plan.sub_plans.all? { |sub| sub.result == :success }
@@ -674,6 +675,11 @@ module Dynflow
674
675
  end
675
676
  end
676
677
 
678
+ it 'handles empty sub plans when calculating progress' do
679
+ action = create_and_plan_action(PollingBulkParentAction, :count => 0)
680
+ action.run_progress.must_equal 0.1
681
+ end
682
+
677
683
  describe ::Dynflow::Action::Singleton do
678
684
  include TestHelpers
679
685
 
@@ -61,7 +61,7 @@ module Dynflow
61
61
  end
62
62
 
63
63
  describe ::Dynflow::Semaphores::Aggregating do
64
- let(:klass) { ::Dynflow::Semaphores::Aggregating }
64
+ let(:semaphore_class) { ::Dynflow::Semaphores::Aggregating }
65
65
  let(:child_class) { ::Dynflow::Semaphores::Stateful }
66
66
  let(:children) do
67
67
  {
@@ -77,7 +77,7 @@ module Dynflow
77
77
  end
78
78
 
79
79
  it 'can be used as counter' do
80
- semaphore = klass.new(children)
80
+ semaphore = semaphore_class.new(children)
81
81
  assert_semaphore_state semaphore, 3, 2
82
82
  semaphore.get.must_equal 1
83
83
  assert_semaphore_state semaphore, 2, 1
data/test/test_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'bundler/setup'
2
2
  require 'minitest/reporters'
3
3
  require 'minitest/autorun'
4
4
  require 'minitest/spec'
5
+ ENV['MT_NO_PLUGINS'] = 'true'
5
6
 
6
7
  MiniTest::Reporters.use! if ENV['RM_INFO']
7
8
 
@@ -192,8 +193,10 @@ module TestHelpers
192
193
  executor_id_for_plan(triggered.id)
193
194
  end
194
195
 
196
+ plan = client_world.persistence.load_execution_plan(triggered.id)
197
+ step = plan.steps.values.last
195
198
  wait_for do
196
- client_world.persistence.load_execution_plan(triggered.id).state == :running
199
+ client_world.persistence.load_step(step.execution_plan_id, step.id, client_world).state == :suspended
197
200
  end
198
201
 
199
202
  executor = WorldFactory.created_worlds.find { |e| e.id == executor_id }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.34
4
+ version: 0.8.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Necas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-14 00:00:00.000000000 Z
12
+ date: 2018-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -594,7 +594,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
594
594
  version: '0'
595
595
  requirements: []
596
596
  rubyforge_project:
597
- rubygems_version: 2.6.12
597
+ rubygems_version: 2.7.3
598
598
  signing_key:
599
599
  specification_version: 4
600
600
  summary: DYNamic workFLOW engine