libis-workflow 2.0.37 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +25 -20
- data/lib/libis/workflow.rb +0 -2
- data/lib/libis/workflow/base/file_item.rb +2 -1
- data/lib/libis/workflow/base/work_item.rb +0 -1
- data/lib/libis/workflow/status.rb +3 -1
- data/lib/libis/workflow/task.rb +4 -6
- data/lib/libis/workflow/version.rb +1 -1
- data/libis-workflow.gemspec +1 -4
- data/spec/tasks/camelize_name.rb +1 -1
- data/spec/workflow_spec.rb +4 -4
- metadata +5 -48
- data/lib/libis/workflow/worker.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 584b8e1d60eca39c3f050334e697a01c9385466ee97e135e2f424f6b80e49b99
|
4
|
+
data.tar.gz: 7c105c4a9685e0c12acf6ddeb6bd876e702b4b6638f50c43c593e3b74f5af492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90995692a972340ef2363ccf4b74c16a8bea56b19ae8ee2ee9e9efa011e4f1b65613070d0c2186946d8f82b61a00ece8ad2a65219fa1e7e129a2bec2ddb3b4ec
|
7
|
+
data.tar.gz: 967aaff3c1178c2913bc8e97a82e2bbd4a94759dcac5812999adda01d3d6b4af9a20bb51c4276490818cb097326a244a773476fc91e6bf97f6f17134c1d41c60
|
data/.travis.yml
CHANGED
@@ -3,34 +3,39 @@ sudo: false
|
|
3
3
|
bundler_args: --without development
|
4
4
|
cache: bundler
|
5
5
|
rvm:
|
6
|
-
- 2.3
|
7
|
-
- 2.4
|
8
|
-
- 2.5
|
6
|
+
- 2.3
|
7
|
+
- 2.4
|
8
|
+
- 2.5
|
9
|
+
- 2.6
|
9
10
|
- ruby-head
|
10
|
-
- jruby-9.1
|
11
|
+
- jruby-9.1
|
11
12
|
- jruby-head
|
12
13
|
jdk:
|
13
14
|
- openjdk8
|
14
|
-
-
|
15
|
-
-
|
15
|
+
- openjdk10
|
16
|
+
- openjdk11
|
16
17
|
matrix:
|
17
18
|
exclude:
|
18
|
-
- rvm: 2.3
|
19
|
-
jdk:
|
20
|
-
- rvm: 2.3
|
21
|
-
jdk:
|
22
|
-
- rvm: 2.4
|
23
|
-
jdk:
|
24
|
-
- rvm: 2.4
|
25
|
-
jdk:
|
26
|
-
- rvm: 2.5
|
27
|
-
jdk:
|
28
|
-
- rvm: 2.5
|
29
|
-
jdk:
|
19
|
+
- rvm: 2.3
|
20
|
+
jdk: openjdk10
|
21
|
+
- rvm: 2.3
|
22
|
+
jdk: openjdk11
|
23
|
+
- rvm: 2.4
|
24
|
+
jdk: openjdk10
|
25
|
+
- rvm: 2.4
|
26
|
+
jdk: openjdk11
|
27
|
+
- rvm: 2.5
|
28
|
+
jdk: openjdk10
|
29
|
+
- rvm: 2.5
|
30
|
+
jdk: openjdk11
|
31
|
+
- rvm: 2.6
|
32
|
+
jdk: openjdk10
|
33
|
+
- rvm: 2.6
|
34
|
+
jdk: openjdk11
|
30
35
|
- rvm: ruby-head
|
31
|
-
jdk:
|
36
|
+
jdk: openjdk10
|
32
37
|
- rvm: ruby-head
|
33
|
-
jdk:
|
38
|
+
jdk: openjdk11
|
34
39
|
allow_failures:
|
35
40
|
- rvm: ruby-head
|
36
41
|
- rvm: jruby-head
|
data/lib/libis/workflow.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'digest'
|
2
2
|
|
3
3
|
require 'libis/workflow/base/work_item'
|
4
|
+
require 'libis/tools/checksum'
|
4
5
|
|
5
6
|
module Libis
|
6
7
|
module Workflow
|
@@ -40,7 +41,7 @@ module Libis
|
|
40
41
|
self.properties['mode'] = stats.mode
|
41
42
|
self.properties['uid'] = stats.uid
|
42
43
|
self.properties['gid'] = stats.gid
|
43
|
-
set_checksum(:MD5, ::
|
44
|
+
set_checksum(:MD5, ::Libis::Tools::Checksum.hexdigest(name, :MD5)) if File.file?(name)
|
44
45
|
rescue => _e
|
45
46
|
# ignored
|
46
47
|
end
|
@@ -89,7 +89,9 @@ module Libis
|
|
89
89
|
# @param [Integer] max max count.
|
90
90
|
def status_progress(task, progress = nil, max = nil)
|
91
91
|
log_entry = self.status_entry(task)
|
92
|
-
log_entry
|
92
|
+
if log_entry.nil? || STATUS[status_symbol(log_entry['status'])] >= STATUS[:DONE]
|
93
|
+
log_entry = self.add_status_log('task' => task, 'status' => :STARTED, 'created' => DateTime.now)
|
94
|
+
end
|
93
95
|
log_entry['progress'] = progress ? progress : (log_entry['progress'] || 0) + 1
|
94
96
|
log_entry['max'] = max if max
|
95
97
|
log_entry['updated'] = DateTime.now
|
data/lib/libis/workflow/task.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'backports/rails/hash'
|
2
|
-
require 'backports/rails/string'
|
3
|
-
|
4
1
|
require 'libis/tools/parameter'
|
5
2
|
require 'libis/tools/extend/hash'
|
3
|
+
require 'libis/tools/extend/string'
|
6
4
|
require 'libis/tools/logger'
|
7
5
|
|
8
6
|
require 'libis/workflow'
|
@@ -97,7 +95,7 @@ module Libis
|
|
97
95
|
set_status item, :FAILED
|
98
96
|
raise e if parent
|
99
97
|
|
100
|
-
rescue => e
|
98
|
+
rescue Exception => e
|
101
99
|
set_status item, :FAILED
|
102
100
|
fatal_error "Exception occured: #{e.message}", item
|
103
101
|
debug e.backtrace.join("\n")
|
@@ -215,9 +213,9 @@ module Libis
|
|
215
213
|
item.set_status(namepath, :FAILED)
|
216
214
|
break
|
217
215
|
|
218
|
-
rescue => e
|
216
|
+
rescue Exception => e
|
219
217
|
item.set_status(namepath, :FAILED)
|
220
|
-
raise Libis::WorkflowAbort, e.message
|
218
|
+
raise Libis::WorkflowAbort, "#{e.message} @ #{e.backtrace.first}"
|
221
219
|
|
222
220
|
else
|
223
221
|
item = new_item if new_item.is_a?(Libis::Workflow::WorkItem)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Libis
|
2
2
|
module Workflow
|
3
|
-
VERSION = '2.
|
3
|
+
VERSION = '2.1.4' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
|
4
4
|
end
|
5
5
|
end
|
data/libis-workflow.gemspec
CHANGED
@@ -27,14 +27,11 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_development_dependency 'bundler', '~> 1.6'
|
31
30
|
spec.add_development_dependency 'rake', '~> 10.3'
|
32
31
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
33
32
|
spec.add_development_dependency 'simplecov', '~> 0.9'
|
34
33
|
spec.add_development_dependency 'coveralls', '~> 0.7'
|
35
34
|
spec.add_development_dependency 'awesome_print'
|
36
35
|
|
37
|
-
spec.add_runtime_dependency 'libis-tools', '~> 0
|
38
|
-
spec.add_runtime_dependency 'sidekiq', '~> 4.0'
|
39
|
-
spec.add_runtime_dependency 'eldritch', '~> 1.1'
|
36
|
+
spec.add_runtime_dependency 'libis-tools', '~> 1.0'
|
40
37
|
end
|
data/spec/tasks/camelize_name.rb
CHANGED
data/spec/workflow_spec.rb
CHANGED
@@ -10,8 +10,8 @@ def check_output(logoutput, sample_out)
|
|
10
10
|
sample_out = sample_out.lines.to_a.map {|x| x.strip}
|
11
11
|
output = logoutput.string.lines.to_a.map {|x| x[/(?<=\] ).*/].strip}
|
12
12
|
|
13
|
-
puts 'output:'
|
14
|
-
ap output
|
13
|
+
# puts 'output:'
|
14
|
+
# ap output
|
15
15
|
|
16
16
|
expect(output.size).to eq sample_out.size
|
17
17
|
output.each_with_index do |o, i|
|
@@ -20,8 +20,8 @@ def check_output(logoutput, sample_out)
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def check_status_log(status_log, sample_status_log)
|
23
|
-
puts 'status_log:'
|
24
|
-
status_log.each { |e| ap e }
|
23
|
+
# puts 'status_log:'
|
24
|
+
# status_log.each { |e| ap e }
|
25
25
|
expect(status_log.size).to eq sample_status_log.size
|
26
26
|
sample_status_log.each_with_index do |h, i|
|
27
27
|
h.keys.each {|key| expect(status_log[i][key.to_s]).to eq h[key]}
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.6'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.6'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,42 +86,14 @@ dependencies:
|
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.9'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sidekiq
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '4.0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '4.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: eldritch
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '1.1'
|
89
|
+
version: '1.0'
|
132
90
|
type: :runtime
|
133
91
|
prerelease: false
|
134
92
|
version_requirements: !ruby/object:Gem::Requirement
|
135
93
|
requirements:
|
136
94
|
- - "~>"
|
137
95
|
- !ruby/object:Gem::Version
|
138
|
-
version: '1.
|
96
|
+
version: '1.0'
|
139
97
|
description: A simple framework to build custom task/workflow solutions.
|
140
98
|
email: kris.dekeyser@libis.be
|
141
99
|
executables: []
|
@@ -172,7 +130,6 @@ files:
|
|
172
130
|
- lib/libis/workflow/task_runner.rb
|
173
131
|
- lib/libis/workflow/version.rb
|
174
132
|
- lib/libis/workflow/work_item.rb
|
175
|
-
- lib/libis/workflow/worker.rb
|
176
133
|
- lib/libis/workflow/workflow.rb
|
177
134
|
- libis-workflow.gemspec
|
178
135
|
- spec/items.rb
|
@@ -207,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
164
|
version: '0'
|
208
165
|
requirements: []
|
209
166
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.7.
|
167
|
+
rubygems_version: 2.7.8
|
211
168
|
signing_key:
|
212
169
|
specification_version: 4
|
213
170
|
summary: LIBIS Workflow framework.
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'sidekiq'
|
2
|
-
|
3
|
-
require 'libis/tools/extend/hash'
|
4
|
-
require 'libis/workflow/config'
|
5
|
-
require 'libis/workflow/workflow'
|
6
|
-
|
7
|
-
module Libis
|
8
|
-
module Workflow
|
9
|
-
|
10
|
-
class Worker
|
11
|
-
include Sidekiq::Worker
|
12
|
-
|
13
|
-
def perform(job_config, options = {})
|
14
|
-
job = configure(job_config, options)
|
15
|
-
options[:interactive] = false
|
16
|
-
job.execute options
|
17
|
-
end
|
18
|
-
|
19
|
-
def configure(job_config, options = {})
|
20
|
-
log_path = options.delete :log_path
|
21
|
-
if log_path
|
22
|
-
Libis::Workflow::Config.logger = ::Logger.new(
|
23
|
-
File.join(log_path, "#{job_config[:name]}.log"),
|
24
|
-
(options.delete(:log_shift_age) || 'daily'),
|
25
|
-
(options.delete(:log_shift_size) || 1024 ** 2)
|
26
|
-
)
|
27
|
-
Libis::Workflow::Config.logger.formatter = ::Logger::Formatter.new
|
28
|
-
Libis::Workflow::Config.logger.level = (options.delete(:log_level) || ::Logger::DEBUG)
|
29
|
-
end
|
30
|
-
get_job(job_config)
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_job(job_config)
|
34
|
-
job = ::Libis::Workflow::Job.new
|
35
|
-
job.configure job_config.key_symbols_to_strings(recursive: true)
|
36
|
-
job
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|