rockflow 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/rockflow/flow.rb +12 -2
- data/lib/rockflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6f32418bebf4b6bc07857b5c041eaa43362ac2
|
4
|
+
data.tar.gz: 51a8ae2808e2f8dd8c868e57d01ab36a68056a62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40a81c6a30bb032e83ce752b11cb949cbb248909393576890ab5964187f267ff37dd4f3803ea4c0a4c472d8dc91a2ad416ed7134cb1d615e69329f1f8c9a5623
|
7
|
+
data.tar.gz: ba199ad0e1a99cd5535b31c9923319ed51e6a072156f8584bde7a9629d52ef3a4d6b277ddd86bf8c31f47dfaf49e02ca87b667fe2ee7a208a417cdc06d38d9d9
|
data/README.md
CHANGED
@@ -85,8 +85,8 @@ So now i have defined my steps and my flow but how can i execute it? Well simple
|
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
flow = AwesomeFlow.new
|
88
|
-
flow.concert! # execute all steps and returns all steps
|
89
|
-
flow.concert # returns false or true
|
88
|
+
flow.concert! # execute all steps and returns all steps. If an error occurs inside the steps it is raised.
|
89
|
+
flow.concert # returns false or true depending if a step fails.
|
90
90
|
```
|
91
91
|
|
92
92
|
Please note that if any of your steps fail the parallel execution is interrupted and and an exception is raised.
|
data/lib/rockflow/flow.rb
CHANGED
@@ -16,19 +16,28 @@ module Rockflow
|
|
16
16
|
@steps << klazz.new(self, opts)
|
17
17
|
end
|
18
18
|
|
19
|
+
# Returns true or false depending if the flow raised any errors or violated any conditions.
|
20
|
+
# @return [TrueClass, FalseClass] returns true if no exception is raised else false.
|
19
21
|
def concert
|
20
22
|
execute_steps.inject(true) do |result, elem|
|
21
23
|
result && !elem.errors.any?
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
27
|
+
# Returns all steps if successfull. If any error is raised inside the step it is raised.
|
28
|
+
# @return [Array] array of all defined steps in the flow.
|
25
29
|
def concert!
|
26
30
|
execute_steps
|
31
|
+
@steps.map do |step|
|
32
|
+
step.errors
|
33
|
+
end.flatten.each do |error|
|
34
|
+
raise error
|
35
|
+
end
|
27
36
|
end
|
28
37
|
|
29
38
|
def next_free_steps
|
30
39
|
@steps.select do |step|
|
31
|
-
step.after_dependencies_finished? && !step.finished?
|
40
|
+
step.after_dependencies_finished? && !step.finished? && !step.failed?
|
32
41
|
end
|
33
42
|
end
|
34
43
|
|
@@ -41,13 +50,14 @@ module Rockflow
|
|
41
50
|
|
42
51
|
def execute_steps
|
43
52
|
while !steps_finished?
|
53
|
+
break if next_free_steps.blank?
|
44
54
|
::Parallel.each(next_free_steps, threads_or_processes.to_sym => Rockflow.configuration.thread_or_processes) do |step|
|
45
55
|
begin
|
46
56
|
step.execute_pre_conditions
|
47
57
|
step.it_up unless step.failed?
|
48
58
|
step.execute_post_conditions
|
49
59
|
step.finish! unless step.failed?
|
50
|
-
rescue
|
60
|
+
rescue => e
|
51
61
|
step.fail!
|
52
62
|
step.errors << e
|
53
63
|
raise Parallel::Break, e.message
|
data/lib/rockflow/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rockflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erwin Schens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|