dynflow 1.1.3 → 1.1.4

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
2
  SHA256:
3
- metadata.gz: f162fe5b456a60898fad5ea4f3eec20ee1301f4adc8e4939946b03962b0ce12d
4
- data.tar.gz: 591f53a8eafe2f94f61c5988fdc02d39ee8405726522a458394cfaa5dd3a260e
3
+ metadata.gz: 36610c9601830c752e4cf36716d91b8fc2703d16796d5812e550440a6f0a0b76
4
+ data.tar.gz: 149131675b4b1f0f2858b4ebd59d3b9ac2fbc74404194c738d3f2ac90944d86d
5
5
  SHA512:
6
- metadata.gz: 41345060fa6037bd1d10f9f6c3515ffe495b131e71744a8820d112f0547f21426b3829de522d1d4571cc4beecfde12f350f080f83fa62ec1be67652a976ef49d
7
- data.tar.gz: 7ecec4743683c885c4e98caf978d1cd75d0647da11d88baab5b051fffa0192ee727d6feef1d61fbc1906f874f412f5486a9eb516e5a7aeded9c343de2f6df25d
6
+ metadata.gz: 06bc662c810b038ae134f04550e44b6a5d0d8de46241487d1cb61a7ebc08ba09e9b0f16024ccd0150f2621188afe39197f88cc161dd6814b7dd35a0a9d0de69e
7
+ data.tar.gz: ab4b95daedddcf60b52af392d83eff308eca24a0ff621bdfd8c7f334fd7268531585bba4df83eba8207a03eaa05efc6d276ffb01435146c2d6b83beacd9f593b
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative 'example_helper'
4
+
5
+ class Sleeper < Dynflow::Action
6
+ def run(event = nil)
7
+ sleep
8
+ end
9
+ end
10
+
11
+ def report(msg)
12
+ puts "===== #{Time.now}: #{msg}"
13
+ end
14
+
15
+ if $0 == __FILE__
16
+ ExampleHelper.world.action_logger.level = 1
17
+ ExampleHelper.world.logger.level = 0
18
+
19
+ ExampleHelper.world.trigger(Sleeper)
20
+ report "Sleeping"
21
+ sleep 5
22
+
23
+ report "Asking to terminate"
24
+ ExampleHelper.world.terminate.wait
25
+ report "Terminated"
26
+ end
@@ -95,10 +95,14 @@ module Dynflow
95
95
  private
96
96
 
97
97
  def try_to_terminate
98
- if terminating? && @free_workers.size == @pool_size
98
+ if terminating?
99
99
  @free_workers.map { |worker| worker.ask(:terminate!) }.map(&:wait)
100
- @executor_core.tell([:finish_termination, @name])
101
- finish_termination
100
+ @pool_size -= @free_workers.count
101
+ @free_workers = []
102
+ if @pool_size.zero?
103
+ @executor_core.tell([:finish_termination, @name])
104
+ finish_termination
105
+ end
102
106
  end
103
107
  end
104
108
 
@@ -9,16 +9,17 @@ module Dynflow
9
9
  end
10
10
 
11
11
  def on_message(work_item)
12
- already_responded = false
12
+ ok = false
13
13
  Executors.run_user_code do
14
14
  work_item.execute
15
+ ok = true
15
16
  end
16
17
  rescue Errors::PersistenceError => e
17
18
  @pool.tell([:handle_persistence_error, reference, e, work_item])
18
- already_responded = true
19
+ ok = false
19
20
  ensure
20
21
  Dynflow::Telemetry.with_instance { |t| t.increment_counter(:dynflow_worker_events, 1, @telemetry_options) }
21
- @pool.tell([:worker_done, reference, work_item]) unless already_responded
22
+ @pool.tell([:worker_done, reference, work_item]) if ok
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module Dynflow
2
- VERSION = '1.1.3'.freeze
2
+ VERSION = '1.1.4'.freeze
3
3
  end
data/lib/dynflow/world.rb CHANGED
@@ -332,6 +332,7 @@ module Dynflow
332
332
  @terminating = Concurrent.future do
333
333
  termination_future.wait(termination_timeout)
334
334
  end.on_completion do
335
+ @terminated.complete
335
336
  Thread.new { Kernel.exit } if @exit_on_terminate.true?
336
337
  end
337
338
  end
Binary file
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: 1.1.3
4
+ version: 1.1.4
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: 2018-11-28 00:00:00.000000000 Z
12
+ date: 2018-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -379,6 +379,7 @@ files:
379
379
  - examples/singletons.rb
380
380
  - examples/sub_plan_concurrency_control.rb
381
381
  - examples/sub_plans.rb
382
+ - examples/termination.rb
382
383
  - extras/statsd_mapping.conf
383
384
  - lib/dynflow.rb
384
385
  - lib/dynflow/action.rb
@@ -1 +0,0 @@
1
- web/assets/images/../../../doc/pages/source/images/logo-square.png