libis-workflow-mongoid 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd3db3ee795224eb114f5dfd96a37aa9e8c29c77
|
4
|
+
data.tar.gz: 4f7bc7ddd64cb6d1ebd9b4f20a3a0d4549675626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4c79cc5ac6a543cf2a293c27911b8e90e1bb6bdb667326a0731f1a7f87bac2a972fb0ac399ff7303bc46d8a0576a12eab250ebfc1a2e30c301e60e25518f51
|
7
|
+
data.tar.gz: c6cc337fa3ae699abfef1bf25d4c7c062ee85d19b810b898e9d0e82fae2c85dd40e5eb22df74629507162b6d226885e95df93e3eabf41eb96adec2c9a064a851
|
@@ -18,7 +18,7 @@ module Libis
|
|
18
18
|
field :run_object, type: String
|
19
19
|
field :log_to_file, type: Boolean, default: true
|
20
20
|
field :log_each_run, type: Boolean, default: true
|
21
|
-
field :log_level, type: String, default: '
|
21
|
+
field :log_level, type: String, default: 'INFO'
|
22
22
|
field :log_age, type: String, default: 'daily'
|
23
23
|
field :log_keep, type: Integer, default: 5
|
24
24
|
|
@@ -8,7 +8,8 @@ module Libis
|
|
8
8
|
module Mongoid
|
9
9
|
|
10
10
|
class LogEntry
|
11
|
-
include
|
11
|
+
include ::Mongoid::Document
|
12
|
+
include ::Mongoid::Timestamps::Created::Short
|
12
13
|
|
13
14
|
store_in collection: 'log'
|
14
15
|
|
@@ -19,6 +20,7 @@ module Libis
|
|
19
20
|
field :status, type: String
|
20
21
|
field :run_id
|
21
22
|
|
23
|
+
index({c_at: 1}, {name: 'by_created'})
|
22
24
|
index({logger_type: 1, logger_id: 1, c_at: 1, }, {background: true, name: 'by_logger'})
|
23
25
|
index({logger_type: 1, logger_id: 1, c_at: 1, task: 1}, {background: true, name: 'by_task'})
|
24
26
|
index({logger_type: 1, logger_id: 1, c_at: 1, status: 1}, {background: true, sparse: true, name: 'by_status'})
|
@@ -12,7 +12,7 @@ module Libis
|
|
12
12
|
|
13
13
|
field :start_date, type: Time, default: -> { Time.now }
|
14
14
|
field :log_to_file, type: Boolean, default: false
|
15
|
-
field :log_level, type: String, default: '
|
15
|
+
field :log_level, type: String, default: 'INFO'
|
16
16
|
field :log_filename, type: String
|
17
17
|
|
18
18
|
index({start_date: 1}, {sparse: 1, name: 'by_start'})
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Libis
|
2
2
|
module Workflow
|
3
3
|
module Mongoid
|
4
|
-
VERSION = '2.0.
|
4
|
+
VERSION = '2.0.12' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
data/spec/workflow_spec.rb
CHANGED
@@ -35,6 +35,8 @@ describe 'TestWorkflow' do
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
+
let(:logoutput) { ::Libis::Workflow::Config.logger.appenders.first.sio }
|
39
|
+
|
38
40
|
let(:workflow) {
|
39
41
|
wf = TestWorkflow.find_or_initialize_by(name: 'TestWorkflow')
|
40
42
|
wf.configure(
|
@@ -66,7 +68,8 @@ describe 'TestWorkflow' do
|
|
66
68
|
'workflow' => workflow,
|
67
69
|
'run_object' => 'TestRun',
|
68
70
|
'input' => {'dirname' => dirname, 'checksum_type' => 'SHA256'},
|
69
|
-
'log_to_file' => false
|
71
|
+
'log_to_file' => false,
|
72
|
+
'log_each_run' => false
|
70
73
|
)
|
71
74
|
|
72
75
|
# job = TestJob.find_or_initialize_by(name: 'TestJob')
|
@@ -87,13 +90,11 @@ describe 'TestWorkflow' do
|
|
87
90
|
|
88
91
|
let(:run) { job.execute }
|
89
92
|
|
90
|
-
let(:logoutput) { ::Libis::Tools::Config.logger.appenders.first.sio }
|
91
|
-
|
92
93
|
it 'should contain three tasks' do
|
93
94
|
|
94
|
-
expect(workflow.config['tasks'].size).to eq
|
95
|
+
expect(workflow.config['tasks'].size).to eq 2
|
95
96
|
expect(workflow.config['tasks'].first['class']).to eq 'CollectFiles'
|
96
|
-
expect(workflow.config['tasks'].last['
|
97
|
+
expect(workflow.config['tasks'].last['name']).to eq 'ProcessFiles'
|
97
98
|
|
98
99
|
end
|
99
100
|
|
@@ -121,15 +122,11 @@ describe 'TestWorkflow' do
|
|
121
122
|
|
122
123
|
it 'should return expected debug output' do
|
123
124
|
|
124
|
-
|
125
|
-
expect(run.log_history.count).to eq 8
|
126
|
-
expect(run.status_log.count).to eq 8
|
127
|
-
item = run.items.first
|
128
|
-
expect(item.log_history.count).to eq 15
|
129
|
-
expect(item.status_log.count).to eq 6
|
130
|
-
expect(item.summary['DEBUG']).to eq 15
|
125
|
+
run
|
131
126
|
|
132
127
|
sample_out = <<STR
|
128
|
+
Run - TestRun : Ingest run started.
|
129
|
+
Run - TestRun : Running subtask (1/2): CollectFiles
|
133
130
|
CollectFiles - TestRun : Processing subitem (1/1): items
|
134
131
|
CollectFiles - items : Processing subitem (1/4): test_dir_item.rb
|
135
132
|
CollectFiles - items : Processing subitem (2/4): test_file_item.rb
|
@@ -137,6 +134,7 @@ CollectFiles - items : Processing subitem (3/4): test_item.rb
|
|
137
134
|
CollectFiles - items : Processing subitem (4/4): test_run.rb
|
138
135
|
CollectFiles - items : 4 of 4 subitems passed
|
139
136
|
CollectFiles - TestRun : 1 of 1 subitems passed
|
137
|
+
Run - TestRun : Running subtask (2/2): ProcessFiles
|
140
138
|
ProcessFiles - TestRun : Running subtask (1/2): ChecksumTester
|
141
139
|
ProcessFiles/ChecksumTester - TestRun : Processing subitem (1/1): items
|
142
140
|
ProcessFiles/ChecksumTester - items : Processing subitem (1/4): test_dir_item.rb
|
@@ -153,10 +151,23 @@ ProcessFiles/CamelizeName - Items : Processing subitem (3/4): test_item.rb
|
|
153
151
|
ProcessFiles/CamelizeName - Items : Processing subitem (4/4): test_run.rb
|
154
152
|
ProcessFiles/CamelizeName - Items : 4 of 4 subitems passed
|
155
153
|
ProcessFiles/CamelizeName - TestRun : 1 of 1 subitems passed
|
154
|
+
ProcessFiles - TestRun : Done
|
155
|
+
Run - TestRun : Done
|
156
156
|
STR
|
157
|
+
|
157
158
|
sample_out = sample_out.lines.to_a
|
158
159
|
output = logoutput.string.lines
|
159
160
|
|
161
|
+
# puts output
|
162
|
+
|
163
|
+
expect(run.summary['DEBUG']).to eq 21
|
164
|
+
expect(run.log_history.count).to eq 13
|
165
|
+
expect(run.status_log.count).to eq 10
|
166
|
+
item = run.items.first
|
167
|
+
expect(item.log_history.count).to eq 15
|
168
|
+
expect(item.status_log.count).to eq 6
|
169
|
+
expect(item.summary['DEBUG']).to eq 15
|
170
|
+
|
160
171
|
expect(output.count).to eq sample_out.count
|
161
172
|
output.each_with_index do |o, i|
|
162
173
|
expect(o.strip).to match(/#{Regexp.escape sample_out[i].strip}$/)
|
@@ -172,7 +183,7 @@ STR
|
|
172
183
|
expect(wf.description).to eq 'Workflow for testing'
|
173
184
|
expect(wf.input.count).to eq 2
|
174
185
|
expect(wf.input[:dirname][:default]).to eq '.'
|
175
|
-
expect(wf.config['tasks'].count).to eq
|
186
|
+
expect(wf.config['tasks'].count).to eq 2
|
176
187
|
expect(wf.config['tasks'][0]['class']).to eq 'CollectFiles'
|
177
188
|
expect(wf.config['tasks'][0]['recursive']).to eq true
|
178
189
|
expect(wf.config['tasks'][1]['name']).to eq 'ProcessFiles'
|
@@ -182,7 +193,6 @@ STR
|
|
182
193
|
expect(wf.config['tasks'][1]['tasks'][0]['recursive']).to eq true
|
183
194
|
expect(wf.config['tasks'][1]['tasks'][1]['class']).to eq 'CamelizeName'
|
184
195
|
expect(wf.config['tasks'][1]['tasks'][1]['recursive']).to eq true
|
185
|
-
expect(wf.config['tasks'][2]['class']).to eq '::Libis::Workflow::Tasks::Analyzer'
|
186
196
|
end
|
187
197
|
|
188
198
|
# noinspection RubyResolve
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-workflow-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libis-workflow
|