dynflow 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/dynflow/action.rb +2 -2
- data/lib/dynflow/execution_plan.rb +9 -13
- data/lib/dynflow/executors/parallel/sequential_manager.rb +4 -8
- data/lib/dynflow/middleware.rb +1 -0
- data/lib/dynflow/middleware/common/transaction.rb +24 -0
- data/lib/dynflow/middleware/register.rb +4 -0
- data/lib/dynflow/middleware/resolver.rb +1 -1
- data/lib/dynflow/version.rb +1 -1
- data/lib/dynflow/world.rb +1 -0
- data/test/middleware_test.rb +7 -0
- data/test/support/middleware_example.rb +8 -2
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Yzg4NmU2OGNkOWMxM2RmZWUxZWE2ZjQyODYzMWEzNGU4ZGUyNDcyNQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a7b3c98ca442720d5347a919d9f6eeb19047c733
|
4
|
+
data.tar.gz: b8608c8e122217bf72ca17e8567203c3da175ebe
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZDQxZDM4MzhiZjk1MjljMjFlNTg2ZTA4Njc5ZTY3YmNjOGRkNzQ4NDA4MDRl
|
11
|
-
NjkzOTJmZjBmZDIxYTFjYjJkNjg1ZDcwMGI0ZWFlMjk2NDQ3OTU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZTJiZGRjOTY2ODdhZjMzMTBhNDEzMDhjYjQ2ZGZiYmU0MzU5ZGI1ZjBmZDBi
|
14
|
-
ODM4MDJkNDAxYWJkMDhlY2NlMGEzY2RjNzkyNDBlZTI1NmU1MGFkZTMwNDFh
|
15
|
-
ZTQyYzJiODM0Y2Y3NDRlM2M3NmQ0NDhkZmY2MDQ0MDBjOWFmMTc=
|
6
|
+
metadata.gz: 9b74f383903ae4ee7487c1273718305302180b6a42f4b6311ab0fe23b57620bd6a3e8b2b67870e5b9a7b23e6fcd7296b5fd0c18dcf3ec4c7cb033885e6088d8c
|
7
|
+
data.tar.gz: 401a024d25af878b4cff93e30d8be55c372e3427442aa1d8aa4ab75fac0f538d513721f5d8924494b756020f1b57d44123c2ad33474ae398421d6888a1cd277b
|
data/lib/dynflow/action.rb
CHANGED
@@ -282,8 +282,8 @@ module Dynflow
|
|
282
282
|
|
283
283
|
def execute_delay(delay_options, *args)
|
284
284
|
with_error_handling(true) do
|
285
|
-
world.middleware.execute(:delay, self, delay_options, *args) do
|
286
|
-
@serializer = delay(
|
285
|
+
world.middleware.execute(:delay, self, delay_options, *args) do |*new_args|
|
286
|
+
@serializer = delay(*new_args).tap do |serializer|
|
287
287
|
serializer.perform_serialization!
|
288
288
|
end
|
289
289
|
end
|
@@ -182,22 +182,18 @@ module Dynflow
|
|
182
182
|
|
183
183
|
def plan(*args)
|
184
184
|
update_state(:planning)
|
185
|
-
world.
|
186
|
-
|
187
|
-
|
188
|
-
root_plan_step.execute(self, nil, false, *args)
|
189
|
-
|
190
|
-
if @dependency_graph.unresolved?
|
191
|
-
raise "Some dependencies were not resolved: #{@dependency_graph.inspect}"
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
185
|
+
world.middleware.execute(:plan_phase, root_plan_step.action_class, self) do
|
186
|
+
with_planning_scope do
|
187
|
+
root_plan_step.execute(self, nil, false, *args)
|
195
188
|
|
196
|
-
|
197
|
-
|
189
|
+
if @dependency_graph.unresolved?
|
190
|
+
raise "Some dependencies were not resolved: #{@dependency_graph.inspect}"
|
191
|
+
end
|
198
192
|
end
|
193
|
+
end
|
199
194
|
|
200
|
-
|
195
|
+
if @run_flow.size == 1
|
196
|
+
@run_flow = @run_flow.sub_flows.first
|
201
197
|
end
|
202
198
|
steps.values.each(&:save)
|
203
199
|
update_state(error? ? :stopped : :planned)
|
@@ -21,14 +21,10 @@ module Dynflow
|
|
21
21
|
def finalize
|
22
22
|
reset_finalize_steps
|
23
23
|
unless execution_plan.error?
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
unless dispatch(execution_plan.finalize_flow)
|
29
|
-
world.transaction_adapter.rollback
|
30
|
-
end
|
31
|
-
end
|
24
|
+
step_id = execution_plan.finalize_flow.all_step_ids.first
|
25
|
+
action_class = execution_plan.steps[step_id].action_class
|
26
|
+
world.middleware.execute(:finalize_phase, action_class, execution_plan) do
|
27
|
+
dispatch(execution_plan.finalize_flow)
|
32
28
|
end
|
33
29
|
end
|
34
30
|
@done = true
|
data/lib/dynflow/middleware.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Dynflow
|
2
|
+
module Middleware::Common
|
3
|
+
class Transaction < Middleware
|
4
|
+
def plan_phase(execution_plan)
|
5
|
+
rollback_on_error(execution_plan)
|
6
|
+
end
|
7
|
+
|
8
|
+
def finalize_phase(execution_plan)
|
9
|
+
rollback_on_error(execution_plan)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def rollback_on_error(execution_plan)
|
15
|
+
execution_plan.world.transaction_adapter.transaction do
|
16
|
+
pass(execution_plan)
|
17
|
+
if execution_plan.error?
|
18
|
+
execution_plan.world.transaction_adapter.rollback
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/dynflow/version.rb
CHANGED
data/lib/dynflow/world.rb
CHANGED
@@ -24,6 +24,7 @@ module Dynflow
|
|
24
24
|
@exit_on_terminate = config_for_world.exit_on_terminate
|
25
25
|
@connector = config_for_world.connector
|
26
26
|
@middleware = Middleware::World.new
|
27
|
+
@middleware.use Middleware::Common::Transaction if @transaction_adapter
|
27
28
|
@client_dispatcher = spawn_and_wait(Dispatcher::ClientDispatcher, "client-dispatcher", self)
|
28
29
|
@meta = config_for_world.meta
|
29
30
|
@auto_validity_check = config_for_world.auto_validity_check
|
data/test/middleware_test.rb
CHANGED
@@ -99,6 +99,13 @@ module Dynflow
|
|
99
99
|
AnotherLogRunMiddleware::after_run]
|
100
100
|
end
|
101
101
|
end
|
102
|
+
|
103
|
+
describe "remove" do
|
104
|
+
specify do
|
105
|
+
world.trigger(Support::MiddlewareExample::SubActionDoNotUseRule, {}).finished.wait
|
106
|
+
log.must_equal %w[run]
|
107
|
+
end
|
108
|
+
end
|
102
109
|
end
|
103
110
|
|
104
111
|
it "allows access the running action" do
|
@@ -39,13 +39,13 @@ module Support
|
|
39
39
|
log 'after_finalize'
|
40
40
|
end
|
41
41
|
|
42
|
-
def plan_phase
|
42
|
+
def plan_phase(*_)
|
43
43
|
log 'before_plan_phase'
|
44
44
|
pass
|
45
45
|
log 'after_plan_phase'
|
46
46
|
end
|
47
47
|
|
48
|
-
def finalize_phase
|
48
|
+
def finalize_phase(*_)
|
49
49
|
log 'before_finalize_phase'
|
50
50
|
pass
|
51
51
|
log 'after_finalize_phase'
|
@@ -152,6 +152,12 @@ module Support
|
|
152
152
|
middleware.use AnotherLogRunMiddleware, replace: LogRunMiddleware
|
153
153
|
end
|
154
154
|
|
155
|
+
class SubActionDoNotUseRule < Action
|
156
|
+
middleware.use AnotherLogRunMiddleware
|
157
|
+
middleware.do_not_use AnotherLogRunMiddleware
|
158
|
+
middleware.do_not_use LogRunMiddleware
|
159
|
+
end
|
160
|
+
|
155
161
|
class SubActionAfterRule < Action
|
156
162
|
middleware.use AnotherLogRunMiddleware, after: LogRunMiddleware
|
157
163
|
end
|
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.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Necas
|
@@ -9,174 +9,174 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: apipie-params
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: algebrick
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 0.7.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.7.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: concurrent-ruby
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.9.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 0.9.0
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: concurrent-ruby-edge
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - ~>
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 0.1.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - ~>
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 0.1.0
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: sequel
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rack-test
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: minitest
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: minitest-reporters
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: activerecord
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- -
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: sqlite3
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- -
|
158
|
+
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- -
|
165
|
+
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: sinatra
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- -
|
172
|
+
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
type: :development
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
description: Ruby workflow/orchestration engine
|
@@ -186,8 +186,8 @@ executables: []
|
|
186
186
|
extensions: []
|
187
187
|
extra_rdoc_files: []
|
188
188
|
files:
|
189
|
-
- .gitignore
|
190
|
-
- .travis.yml
|
189
|
+
- ".gitignore"
|
190
|
+
- ".travis.yml"
|
191
191
|
- Gemfile
|
192
192
|
- MIT-LICENSE
|
193
193
|
- README.md
|
@@ -402,6 +402,7 @@ files:
|
|
402
402
|
- lib/dynflow/logger_adapters/formatters/exception.rb
|
403
403
|
- lib/dynflow/logger_adapters/simple.rb
|
404
404
|
- lib/dynflow/middleware.rb
|
405
|
+
- lib/dynflow/middleware/common/transaction.rb
|
405
406
|
- lib/dynflow/middleware/register.rb
|
406
407
|
- lib/dynflow/middleware/resolver.rb
|
407
408
|
- lib/dynflow/middleware/stack.rb
|
@@ -508,17 +509,17 @@ require_paths:
|
|
508
509
|
- lib
|
509
510
|
required_ruby_version: !ruby/object:Gem::Requirement
|
510
511
|
requirements:
|
511
|
-
- -
|
512
|
+
- - ">="
|
512
513
|
- !ruby/object:Gem::Version
|
513
514
|
version: 1.9.3
|
514
515
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
515
516
|
requirements:
|
516
|
-
- -
|
517
|
+
- - ">="
|
517
518
|
- !ruby/object:Gem::Version
|
518
519
|
version: '0'
|
519
520
|
requirements: []
|
520
521
|
rubyforge_project:
|
521
|
-
rubygems_version: 2.4.
|
522
|
+
rubygems_version: 2.4.5
|
522
523
|
signing_key:
|
523
524
|
specification_version: 4
|
524
525
|
summary: DYNamic workFLOW engine
|
@@ -545,4 +546,3 @@ test_files:
|
|
545
546
|
- test/testing_test.rb
|
546
547
|
- test/web_console_test.rb
|
547
548
|
- test/world_test.rb
|
548
|
-
has_rdoc:
|