dynflow 0.8.36 → 0.8.37

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: 9d355c9b625deb22695548050c4d72ee3c43ce3a14e43488507173554c9c04d0
4
- data.tar.gz: 63693d7793f8e1f12ff03d4b0b9ea3e9bbb1114f701cd92f470dd268f8dac732
3
+ metadata.gz: 07d302583997706186e5c5a55185a32b35757971615e5e42b73d9121cab2d23d
4
+ data.tar.gz: 9b5f20a8788784b95f4f52d66f3af1b7b1425f077a370b51a2e2ca2aed2b1c10
5
5
  SHA512:
6
- metadata.gz: 6760a74b0ec0f87e9ffb01a87f322b4151be4b1ddb578aa4ce56956f363a0a75db7bbcfbdf1eecc370dedc0b5ea1e182e4d85b86c22b411947b728ac531ed69f
7
- data.tar.gz: 29a76f2faa3d93a24269c1cc233ca5f4cde5865e5c454dfb945b2605a184fc29203b7bb4f5a99100695557332bf6a0690f999ed4026dfc9570877f6085d8b374
6
+ metadata.gz: 3cd1c9ca74ab31c3afead86db86af7565c2f34e71c48d608d0dcac3ba105f0113fed48f9560865a3acced8545dd0daa55f7149311b91d81387b8ab00e2132aa8
7
+ data.tar.gz: 6fbf67d06c58b64076178aed4cd271d07d1ac89b5a6d962360dd140a63324c738552e74586d9d350e08216963ffa925cacffa53be45fb932ad9a982ada1b6bae
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  layout: page
3
3
  title: "404"
4
+ permalink: /404.html
4
5
  ---
5
6
 
6
7
  We are sorry, page You are looking for does not exist :'(
@@ -1,7 +1,6 @@
1
1
  <!--TODO make active-->
2
2
  <li><a href="/">About</a></li>
3
3
  <li><a href="/documentation/">Documentation</a></li>
4
- <li><a href="/blog/">Blog</a></li>
5
4
  <li><a href="/faq/">FAQ</a></li>
6
5
  <li><a href="/media/">Media</a></li>
7
6
  <li><a href="/projects/">Related projects</a></li>
@@ -1 +1 @@
1
- <li><a class="extra" href="/atom.xml">RSS</a></li>
1
+ <!--<li><a class="extra" href="/atom.xml">RSS</a></li>-->
@@ -9,7 +9,7 @@ comments: true
9
9
  {% danger_block %}
10
10
 
11
11
  Work in progress! It contains a lot of tpyos, please let us know. There are comments at the bottom
12
- or you can submit a PR against [pages branch](https://github.com/dynflow/dynflow/tree/pages).
12
+ or you can submit a PR against [master branch](https://github.com/dynflow/dynflow/tree/master).
13
13
 
14
14
  Please help with the documentation if you know Dynflow.
15
15
 
@@ -52,8 +52,10 @@ module Dynflow
52
52
  plan.timeout
53
53
  else
54
54
  @logger.debug "Executing plan #{plan.execution_plan_uuid}"
55
- plan.plan
56
- plan.execute
55
+ Executors.run_user_code do
56
+ plan.plan
57
+ plan.execute
58
+ end
57
59
  end
58
60
  processed_plan_uuids << plan.execution_plan_uuid
59
61
  end
@@ -60,12 +60,16 @@ module Dynflow
60
60
  # @param action [Action] the action which triggered the hooks
61
61
  # @param kind [Symbol] the kind of hooks to run, one of {HOOK_KINDS}
62
62
  def run(execution_plan, action, kind)
63
- on(kind).each do |hook|
64
- begin
65
- action.send(hook, execution_plan)
66
- rescue => e
67
- execution_plan.logger.error "Failed to run hook '#{hook}' for action '#{action.class}'"
68
- execution_plan.logger.debug e
63
+ hooks = on(kind)
64
+ return if hooks.empty?
65
+ Executors.run_user_code do
66
+ hooks.each do |hook|
67
+ begin
68
+ action.send(hook, execution_plan)
69
+ rescue => e
70
+ execution_plan.logger.error "Failed to run hook '#{hook}' for action '#{action.class}'"
71
+ execution_plan.logger.debug e
72
+ end
69
73
  end
70
74
  end
71
75
  end
@@ -4,5 +4,14 @@ module Dynflow
4
4
  require 'dynflow/executors/abstract'
5
5
  require 'dynflow/executors/parallel'
6
6
 
7
+ # Every time we run a code that can be defined outside of Dynflow,
8
+ # we should wrap it with this method, and we can ensure here to do
9
+ # necessary cleanup, such as cleaning ActiveRecord connections
10
+ def self.run_user_code
11
+ yield
12
+ ensure
13
+ ::ActiveRecord::Base.clear_active_connections! if defined? ::ActiveRecord
14
+ end
15
+
7
16
  end
8
17
  end
@@ -8,12 +8,13 @@ module Dynflow
8
8
  end
9
9
 
10
10
  def on_message(work_item)
11
- work_item.execute
11
+ Executors.run_user_code do
12
+ work_item.execute
13
+ end
12
14
  rescue Errors::PersistenceError => e
13
15
  @pool.tell([:handle_persistence_error, e])
14
16
  ensure
15
17
  @pool.tell([:worker_done, reference, work_item])
16
- @transaction_adapter.cleanup
17
18
  end
18
19
  end
19
20
  end
data/lib/dynflow/rails.rb CHANGED
@@ -41,6 +41,7 @@ module Dynflow
41
41
  config.run_on_init_hooks(world)
42
42
  # leave this just for long-running executors
43
43
  unless config.rake_task_with_executor?
44
+ world.perform_validity_checks
44
45
  world.auto_execute
45
46
  end
46
47
  end
@@ -111,6 +111,7 @@ module Dynflow
111
111
 
112
112
  # we can't do any operation until the Rails.application.dynflow.world is set
113
113
  config.auto_execute = false
114
+ config.auto_validity_check = false
114
115
  end
115
116
  end
116
117
 
@@ -10,12 +10,6 @@ module Dynflow
10
10
  def rollback
11
11
  raise NotImplementedError
12
12
  end
13
-
14
- # Called on each thread after work is done.
15
- # E.g. it's used to checkin ActiveRecord connections back to pool.
16
- def cleanup
17
- # override if needed
18
- end
19
13
  end
20
14
  end
21
15
  end
@@ -8,10 +8,6 @@ module Dynflow
8
8
  def rollback
9
9
  raise ::ActiveRecord::Rollback
10
10
  end
11
-
12
- def cleanup
13
- ::ActiveRecord::Base.clear_active_connections!
14
- end
15
11
  end
16
12
  end
17
13
  end
@@ -1,3 +1,3 @@
1
1
  module Dynflow
2
- VERSION = '0.8.36'.freeze
2
+ VERSION = '0.8.37'.freeze
3
3
  end
data/lib/dynflow/world.rb CHANGED
@@ -42,10 +42,8 @@ module Dynflow
42
42
  @executor_dispatcher = spawn_and_wait(Dispatcher::ExecutorDispatcher, "executor-dispatcher", self, config_for_world.executor_semaphore)
43
43
  executor.initialized.wait
44
44
  end
45
- if auto_validity_check
46
- self.worlds_validity_check
47
- self.locks_validity_check
48
- end
45
+ perform_validity_checks if auto_validity_check
46
+
49
47
  @delayed_executor = try_spawn(config_for_world, :delayed_executor, Coordinator::DelayedExecutorLock)
50
48
  @execution_plan_cleaner = try_spawn(config_for_world, :execution_plan_cleaner, Coordinator::ExecutionPlanCleanerLock)
51
49
  @meta = config_for_world.meta
@@ -337,6 +335,11 @@ module Dynflow
337
335
  logger.error "failed to write data while invalidating execution lock #{execution_lock}"
338
336
  end
339
337
 
338
+ def perform_validity_checks
339
+ worlds_validity_check
340
+ locks_validity_check
341
+ end
342
+
340
343
  def worlds_validity_check(auto_invalidate = true, worlds_filter = {})
341
344
  worlds = coordinator.find_worlds(false, worlds_filter)
342
345
 
data/test/daemon_test.rb CHANGED
@@ -16,6 +16,7 @@ class DaemonTest < ActiveSupport::TestCase
16
16
  @world_class = mock('dummy world factory')
17
17
  @dummy_world = ::Dynflow::Testing::DummyWorld.new
18
18
  @dummy_world.stubs(:auto_execute)
19
+ @dummy_world.stubs(:perform_validity_checks)
19
20
  @event = Concurrent.event
20
21
  @dummy_world.stubs(:terminated).returns(@event)
21
22
  @world_class.stubs(:new).returns(@dummy_world)
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.36
4
+ version: 0.8.37
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-03-06 00:00:00.000000000 Z
12
+ date: 2018-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -252,7 +252,6 @@ files:
252
252
  - doc/pages/plugins/toc.rb
253
253
  - doc/pages/source/.nojekyll
254
254
  - doc/pages/source/404.md
255
- - doc/pages/source/_drafts/2015-03-01-new-documentation.markdown
256
255
  - doc/pages/source/_includes/disqus.html
257
256
  - doc/pages/source/_includes/google_analytics.html
258
257
  - doc/pages/source/_includes/google_plus_one.html
@@ -344,7 +343,6 @@ files:
344
343
  - doc/pages/source/_sass/bootstrap/mixins/_text-overflow.scss
345
344
  - doc/pages/source/_sass/bootstrap/mixins/_vendor-prefixes.scss
346
345
  - doc/pages/source/atom.xml
347
- - doc/pages/source/blog/index.html
348
346
  - doc/pages/source/bootstrap/config.json
349
347
  - doc/pages/source/bootstrap/css/bootstrap-theme.css
350
348
  - doc/pages/source/bootstrap/css/bootstrap-theme.min.css
@@ -1,10 +0,0 @@
1
- ---
2
- layout: post
3
- title: "New documentation"
4
- date: 2015-03-01 10:00
5
- tags:
6
- - documentation
7
- ---
8
-
9
- We have a new Dynflow documentation!
10
-
@@ -1,12 +0,0 @@
1
- ---
2
- layout: page
3
- title: Posts
4
- ---
5
-
6
- {% for post in site.posts %}
7
- {% include post_item.html %}
8
- {% endfor %}
9
-
10
- <p id="tag-cloud">
11
- All tags: {{ site | tag_cloud }}
12
- </p>