libis-workflow 2.0.beta.13 → 2.0.beta.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -44
- data/lib/libis/workflow/action.rb +24 -0
- data/lib/libis/workflow/base/logging.rb +76 -0
- data/lib/libis/workflow/base/run.rb +11 -7
- data/lib/libis/workflow/base/work_item.rb +30 -108
- data/lib/libis/workflow/base/workflow.rb +10 -11
- data/lib/libis/workflow/base.rb +1 -0
- data/lib/libis/workflow/status.rb +83 -0
- data/lib/libis/workflow/task.rb +133 -145
- data/lib/libis/workflow/task_group.rb +62 -0
- data/lib/libis/workflow/tasks/analyzer.rb +2 -4
- data/lib/libis/workflow/version.rb +1 -1
- data/lib/libis/workflow/work_item.rb +2 -10
- data/lib/libis/workflow/worker.rb +3 -3
- data/lib/libis/workflow.rb +4 -0
- data/spec/task_spec.rb +0 -1
- data/spec/workflow_spec.rb +42 -39
- metadata +6 -2
data/spec/workflow_spec.rb
CHANGED
@@ -26,7 +26,7 @@ describe 'TestWorkflow' do
|
|
26
26
|
tasks: [
|
27
27
|
{class: 'CollectFiles', recursive: true},
|
28
28
|
{
|
29
|
-
name: 'ProcessFiles',
|
29
|
+
name: 'ProcessFiles', recursive: false,
|
30
30
|
tasks: [
|
31
31
|
{class: 'ChecksumTester', recursive: true},
|
32
32
|
{class: 'CamelizeName', recursive: true}
|
@@ -53,10 +53,6 @@ describe 'TestWorkflow' do
|
|
53
53
|
job
|
54
54
|
}
|
55
55
|
|
56
|
-
let!(:run) {
|
57
|
-
job.execute
|
58
|
-
}
|
59
|
-
|
60
56
|
it 'should contain three tasks' do
|
61
57
|
expect(workflow.config[:tasks].size).to eq 3
|
62
58
|
expect(workflow.config[:tasks].first[:class]).to eq 'CollectFiles'
|
@@ -65,6 +61,7 @@ describe 'TestWorkflow' do
|
|
65
61
|
|
66
62
|
# noinspection RubyResolve
|
67
63
|
it 'should camelize the workitem name' do
|
64
|
+
run = job.execute
|
68
65
|
puts run.options
|
69
66
|
expect(run.options['CollectFiles'][:location]).to eq dirname
|
70
67
|
expect(run.items.count).to eq 1
|
@@ -88,64 +85,68 @@ DEBUG -- CollectFiles - items : Processing subitem (2/3): test_file_item.rb
|
|
88
85
|
DEBUG -- CollectFiles - items : Processing subitem (3/3): test_run.rb
|
89
86
|
DEBUG -- CollectFiles - items : 3 of 3 subitems passed
|
90
87
|
DEBUG -- CollectFiles - TestRun : 1 of 1 subitems passed
|
91
|
-
DEBUG -- ProcessFiles - TestRun :
|
92
|
-
DEBUG -- ProcessFiles -
|
88
|
+
DEBUG -- ProcessFiles - TestRun : Running subtask (1/2): ChecksumTester
|
89
|
+
DEBUG -- ProcessFiles/ChecksumTester - TestRun : Processing subitem (1/1): items
|
93
90
|
DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (1/3): test_dir_item.rb
|
94
91
|
DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (2/3): test_file_item.rb
|
95
92
|
DEBUG -- ProcessFiles/ChecksumTester - items : Processing subitem (3/3): test_run.rb
|
96
93
|
DEBUG -- ProcessFiles/ChecksumTester - items : 3 of 3 subitems passed
|
97
|
-
DEBUG -- ProcessFiles -
|
94
|
+
DEBUG -- ProcessFiles/ChecksumTester - TestRun : 1 of 1 subitems passed
|
95
|
+
DEBUG -- ProcessFiles - TestRun : Running subtask (2/2): CamelizeName
|
96
|
+
DEBUG -- ProcessFiles/CamelizeName - TestRun : Processing subitem (1/1): items
|
98
97
|
DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (1/3): test_dir_item.rb
|
99
98
|
DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (2/3): test_file_item.rb
|
100
99
|
DEBUG -- ProcessFiles/CamelizeName - Items : Processing subitem (3/3): test_run.rb
|
101
100
|
DEBUG -- ProcessFiles/CamelizeName - Items : 3 of 3 subitems passed
|
102
|
-
DEBUG -- ProcessFiles - TestRun : 1 of 1 subitems passed
|
101
|
+
DEBUG -- ProcessFiles/CamelizeName - TestRun : 1 of 1 subitems passed
|
103
102
|
STR
|
104
103
|
sample_out = sample_out.lines.to_a
|
104
|
+
|
105
|
+
run = job.execute
|
105
106
|
output = logoutput.string.lines.to_a
|
106
107
|
|
107
|
-
expect(
|
108
|
+
expect(output.count).to eq sample_out.count
|
108
109
|
output.each_with_index do |o, i|
|
109
110
|
expect(o[/(?<=\] ).*/]).to eq sample_out[i].strip
|
110
111
|
end
|
111
112
|
|
112
|
-
expect(run.summary['DEBUG']).to eq
|
113
|
-
expect(run.log_history.count).to eq
|
114
|
-
expect(run.status_log.count).to eq
|
115
|
-
expect(run.items.first.log_history.count).to eq
|
116
|
-
expect(run.items.first.status_log.count).to eq
|
113
|
+
expect(run.summary['DEBUG']).to eq 20
|
114
|
+
expect(run.log_history.count).to eq 8
|
115
|
+
expect(run.status_log.count).to eq 8
|
116
|
+
expect(run.items.first.log_history.count).to eq 12
|
117
|
+
expect(run.items.first.status_log.count).to eq 6
|
117
118
|
|
118
119
|
[
|
119
|
-
{
|
120
|
-
{
|
121
|
-
{
|
122
|
-
{
|
123
|
-
{
|
124
|
-
{
|
120
|
+
{task: 'CollectFiles', status: :STARTED},
|
121
|
+
{task: 'CollectFiles', status: :DONE},
|
122
|
+
{task: 'ProcessFiles', status: :STARTED},
|
123
|
+
{task: 'ProcessFiles/ChecksumTester', status: :STARTED},
|
124
|
+
{task: 'ProcessFiles/ChecksumTester', status: :DONE},
|
125
|
+
{task: 'ProcessFiles/CamelizeName', status: :STARTED},
|
126
|
+
{task: 'ProcessFiles/CamelizeName', status: :DONE},
|
127
|
+
{task: 'ProcessFiles', status: :DONE},
|
125
128
|
].each_with_index do |h, i|
|
126
129
|
h.keys.each { |key| expect(run.status_log[i][key]).to eq h[key] }
|
127
130
|
end
|
128
131
|
|
129
132
|
[
|
130
|
-
{
|
131
|
-
{
|
132
|
-
{
|
133
|
-
{
|
134
|
-
{
|
135
|
-
{
|
136
|
-
{tasklist: %w'ProcessFiles CamelizeName', text: :Done},
|
137
|
-
{tasklist: %w'ProcessFiles', text: :Done},
|
133
|
+
{task: 'CollectFiles', status: :STARTED},
|
134
|
+
{task: 'CollectFiles', status: :DONE},
|
135
|
+
{task: 'ProcessFiles/ChecksumTester', status: :STARTED},
|
136
|
+
{task: 'ProcessFiles/ChecksumTester', status: :DONE},
|
137
|
+
{task: 'ProcessFiles/CamelizeName', status: :STARTED},
|
138
|
+
{task: 'ProcessFiles/CamelizeName', status: :DONE},
|
138
139
|
].each_with_index do |h, i|
|
139
140
|
h.keys.each { |key| expect(run.items.first.status_log[i][key]).to eq h[key] }
|
140
141
|
end
|
141
142
|
|
142
143
|
[
|
143
|
-
{
|
144
|
-
{
|
145
|
-
{
|
146
|
-
{
|
147
|
-
{
|
148
|
-
{
|
144
|
+
{task: 'CollectFiles', status: :STARTED},
|
145
|
+
{task: 'CollectFiles', status: :DONE},
|
146
|
+
{task: 'ProcessFiles/ChecksumTester', status: :STARTED},
|
147
|
+
{task: 'ProcessFiles/ChecksumTester', status: :DONE},
|
148
|
+
{task: 'ProcessFiles/CamelizeName', status: :STARTED},
|
149
|
+
{task: 'ProcessFiles/CamelizeName', status: :DONE},
|
149
150
|
].each_with_index do |h, i|
|
150
151
|
h.keys.each { |key| expect(run.items.first.first.status_log[i][key]).to eq h[key] }
|
151
152
|
end
|
@@ -153,8 +154,12 @@ STR
|
|
153
154
|
[
|
154
155
|
{severity: 'DEBUG', task: 'CollectFiles', message: 'Processing subitem (1/1): items'},
|
155
156
|
{severity: 'DEBUG', task: 'CollectFiles', message: '1 of 1 subitems passed'},
|
156
|
-
{severity: 'DEBUG', task: 'ProcessFiles', message: '
|
157
|
-
{severity: 'DEBUG', task: 'ProcessFiles', message: '
|
157
|
+
{severity: 'DEBUG', task: 'ProcessFiles', message: 'Running subtask (1/2): ChecksumTester'},
|
158
|
+
{severity: 'DEBUG', task: 'ProcessFiles/ChecksumTester', message: 'Processing subitem (1/1): items'},
|
159
|
+
{severity: 'DEBUG', task: 'ProcessFiles/ChecksumTester', message: '1 of 1 subitems passed'},
|
160
|
+
{severity: 'DEBUG', task: 'ProcessFiles', message: 'Running subtask (2/2): CamelizeName'},
|
161
|
+
{severity: 'DEBUG', task: 'ProcessFiles/CamelizeName', message: 'Processing subitem (1/1): items'},
|
162
|
+
{severity: 'DEBUG', task: 'ProcessFiles/CamelizeName', message: '1 of 1 subitems passed'},
|
158
163
|
].each_with_index do |h, i|
|
159
164
|
h.keys.each { |key| expect(run.log_history[i][key]).to eq h[key] }
|
160
165
|
end
|
@@ -164,12 +169,10 @@ STR
|
|
164
169
|
{severity: 'DEBUG', task: 'CollectFiles', message: 'Processing subitem (2/3): test_file_item.rb'},
|
165
170
|
{severity: 'DEBUG', task: 'CollectFiles', message: 'Processing subitem (3/3): test_run.rb'},
|
166
171
|
{severity: 'DEBUG', task: 'CollectFiles', message: '3 of 3 subitems passed'},
|
167
|
-
{severity: 'DEBUG', task: 'ProcessFiles', message: 'Running subtask (1/2): ChecksumTester'},
|
168
172
|
{severity: 'DEBUG', task: 'ProcessFiles/ChecksumTester', message: 'Processing subitem (1/3): test_dir_item.rb'},
|
169
173
|
{severity: 'DEBUG', task: 'ProcessFiles/ChecksumTester', message: 'Processing subitem (2/3): test_file_item.rb'},
|
170
174
|
{severity: 'DEBUG', task: 'ProcessFiles/ChecksumTester', message: 'Processing subitem (3/3): test_run.rb'},
|
171
175
|
{severity: 'DEBUG', task: 'ProcessFiles/ChecksumTester', message: '3 of 3 subitems passed'},
|
172
|
-
{severity: 'DEBUG', task: 'ProcessFiles', message: 'Running subtask (2/2): CamelizeName'},
|
173
176
|
{severity: 'DEBUG', task: 'ProcessFiles/CamelizeName', message: 'Processing subitem (1/3): test_dir_item.rb'},
|
174
177
|
{severity: 'DEBUG', task: 'ProcessFiles/CamelizeName', message: 'Processing subitem (2/3): test_file_item.rb'},
|
175
178
|
{severity: 'DEBUG', task: 'ProcessFiles/CamelizeName', message: 'Processing subitem (3/3): test_run.rb'},
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.beta.
|
4
|
+
version: 2.0.beta.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,11 +124,13 @@ files:
|
|
124
124
|
- lib/libis-workflow.rb
|
125
125
|
- lib/libis/exceptions.rb
|
126
126
|
- lib/libis/workflow.rb
|
127
|
+
- lib/libis/workflow/action.rb
|
127
128
|
- lib/libis/workflow/base.rb
|
128
129
|
- lib/libis/workflow/base/dir_item.rb
|
129
130
|
- lib/libis/workflow/base/file_item.rb
|
130
131
|
- lib/libis/workflow/base/job.rb
|
131
132
|
- lib/libis/workflow/base/logger.rb
|
133
|
+
- lib/libis/workflow/base/logging.rb
|
132
134
|
- lib/libis/workflow/base/run.rb
|
133
135
|
- lib/libis/workflow/base/work_item.rb
|
134
136
|
- lib/libis/workflow/base/workflow.rb
|
@@ -138,7 +140,9 @@ files:
|
|
138
140
|
- lib/libis/workflow/job.rb
|
139
141
|
- lib/libis/workflow/message_registry.rb
|
140
142
|
- lib/libis/workflow/run.rb
|
143
|
+
- lib/libis/workflow/status.rb
|
141
144
|
- lib/libis/workflow/task.rb
|
145
|
+
- lib/libis/workflow/task_group.rb
|
142
146
|
- lib/libis/workflow/tasks/analyzer.rb
|
143
147
|
- lib/libis/workflow/version.rb
|
144
148
|
- lib/libis/workflow/work_item.rb
|