libis-workflow 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba3fa96f34242e5014b961b73fbf591a4c5b3b1b
4
- data.tar.gz: 5912a5ca488f2faff208fa86dcc170c637535aaa
3
+ metadata.gz: 4811293c017ab0613375ec887877536727046749
4
+ data.tar.gz: b8180f2d746875ff2475c7760cb31d2c58e781fa
5
5
  SHA512:
6
- metadata.gz: 3703ecdbb6b1687af55d8398e2a60e4e47f3229febc59c056022576d5ad8cba8fc1955eec9af1e582c4d810ad149ebc9174d62a17f615c505aef8cfedcccad7d
7
- data.tar.gz: 625031f3b020ff8ace2368822560257da66cc998dd39b5389f5e4b6d785e9697da1d1d9980ff4418697d8b6434dbc5154bb4ff03cdadfe2245190e0d69141b7d
6
+ metadata.gz: 55849f68aa4bc0c2c22a7483f361ed47bdee6fb896cf561a81af2df9425865dfe08805e8fb05fe966bec66cd7e02d9df1482fc015267dc5e94a234c88ce2c57c
7
+ data.tar.gz: bfe38e532a17aad2ad86ae6d2c0731b8f94a0542432fc84559361c1235343f8181d2140ac2b0577d4b4687a7ac0d6a52db66ae8be8abfa118e9c947206b413a7
data/README.md CHANGED
@@ -214,11 +214,11 @@ Work items that are file-based can derive from the ::Libis::Workflow::FileItem c
214
214
  end
215
215
 
216
216
  def filesize
217
- properties['size']
217
+ properties[:size]
218
218
  end
219
219
 
220
220
  def fixity_check(checksum)
221
- properties['checksum'] == checksum
221
+ properties[:checksum] == checksum
222
222
  end
223
223
 
224
224
  end
@@ -239,11 +239,11 @@ or include the ::Libis::Workflow::Base::FileItem module:
239
239
  end
240
240
 
241
241
  def filesize
242
- properties['size']
242
+ properties[:size]
243
243
  end
244
244
 
245
245
  def fixity_check(checksum)
246
- properties['checksum'] == checksum
246
+ properties[:checksum] == checksum
247
247
  end
248
248
 
249
249
  end
@@ -13,11 +13,11 @@ module Libis
13
13
  include Libis::Workflow::Base::WorkItem
14
14
 
15
15
  def filename
16
- File.basename(self.properties['filename']) || self.properties['link']
16
+ File.basename(self.properties[:filename]) || self.properties[:link]
17
17
  end
18
18
 
19
19
  def name
20
- self.properties['name'] || self.filename
20
+ self.properties[:name] || self.filename
21
21
  end
22
22
 
23
23
  def filelist
@@ -29,24 +29,24 @@ module Libis
29
29
  end
30
30
 
31
31
  def fullpath
32
- self.properties['filename']
32
+ self.properties[:filename]
33
33
  end
34
34
 
35
35
  def filename=(name)
36
36
  begin
37
37
  stats = ::File.stat name
38
- self.properties['size'] = stats.size
39
- self.properties['access_time'] = stats.atime
40
- self.properties['modification_time'] = stats.mtime
41
- self.properties['creation_time'] = stats.ctime
42
- self.properties['mode'] = stats.mode
43
- self.properties['uid'] = stats.uid
44
- self.properties['gid'] = stats.gid
38
+ self.properties[:size] = stats.size
39
+ self.properties[:access_time] = stats.atime
40
+ self.properties[:modification_time] = stats.mtime
41
+ self.properties[:creation_time] = stats.ctime
42
+ self.properties[:mode] = stats.mode
43
+ self.properties[:uid] = stats.uid
44
+ self.properties[:gid] = stats.gid
45
45
  set_checksum(:MD5, ::Digest::MD5.hexdigest(File.read(name))) if File.file?(name)
46
46
  rescue
47
47
  # ignored
48
48
  end
49
- self.properties['filename'] = name
49
+ self.properties[:filename] = name
50
50
  end
51
51
 
52
52
  def checksum(checksum_type)
@@ -58,11 +58,11 @@ module Libis
58
58
  end
59
59
 
60
60
  def link
61
- self.properties['link']
61
+ self.properties[:link]
62
62
  end
63
63
 
64
64
  def link=(name)
65
- self.properties['link'] = name
65
+ self.properties[:link] = name
66
66
  end
67
67
 
68
68
  def set_info(info)
@@ -49,7 +49,6 @@ module Libis
49
49
  self.name ||= ''
50
50
  self.description ||= ''
51
51
  self.input ||= {}
52
-
53
52
  self.name = cfg[:name] if cfg.has_key?(:name)
54
53
  self.description = cfg[:description] if cfg.has_key?(:description)
55
54
  self.workflow = cfg[:workflow] if cfg.has_key?(:workflow)
@@ -64,8 +63,9 @@ module Libis
64
63
  raise RuntimeError.new "Could not create instance of run object '#{self.run_object}'" unless run
65
64
 
66
65
  run.job = self
66
+ opts.key_strings_to_symbols!(recursive: true)
67
67
  (opts.delete(:run_config) || {}).each { |key,value| run.send(key, value) }
68
- run.options = self.input.merge(opts)
68
+ run.options.merge!(self.input.merge(opts))
69
69
  run.save
70
70
 
71
71
  run.run
@@ -50,7 +50,7 @@ module Libis
50
50
  end
51
51
 
52
52
  def logger
53
- self.properties['logger'] || self.job.logger rescue ::Libis::Workflow::Config.logger
53
+ self.properties[:logger] || self.job.logger rescue ::Libis::Workflow::Config.logger
54
54
  end
55
55
 
56
56
  # Execute the workflow.
@@ -65,7 +65,7 @@ module Libis
65
65
  def run(action = :run)
66
66
  self.action = action
67
67
 
68
- self.start_date = Time.now
68
+ self.start_date = Time.now unless action == :retry
69
69
 
70
70
  self.options = workflow.prepare_input(self.options)
71
71
 
@@ -83,7 +83,7 @@ module Libis
83
83
  # @return [String] string identification for this work item.
84
84
  def name
85
85
  # noinspection RubyResolve
86
- self.properties['name'] || self.inspect
86
+ self.properties[:name] || self.inspect
87
87
  end
88
88
 
89
89
  def to_s;
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'libis/tools/parameter'
4
4
  require 'libis/workflow/task_group'
5
+ require 'libis/tools/extend/hash'
5
6
 
6
7
  module Libis
7
8
  module Workflow
@@ -73,7 +74,6 @@ module Libis
73
74
  end
74
75
 
75
76
  def self.included(base)
76
-
77
77
  base.extend ClassMethods
78
78
  end
79
79
 
@@ -85,7 +85,9 @@ module Libis
85
85
 
86
86
  self.class.require_all
87
87
 
88
- unless self.config[:tasks].last[:class] && self.config[:tasks].last[:class].split('::').last == 'Analyzer'
88
+ unless !self.config[:tasks].empty? &&
89
+ self.config[:tasks].last[:class] &&
90
+ self.config[:tasks].last[:class].split('::').last == 'Analyzer'
89
91
  self.config[:tasks] << {class: '::Libis::Workflow::Tasks::Analyzer'}
90
92
  end
91
93
 
@@ -124,7 +126,7 @@ module Libis
124
126
  task_name, param_name = target.split('#')
125
127
  param_name ||= key
126
128
  result[task_name] ||= {}
127
- result[task_name][param_name.to_s] = value
129
+ result[task_name][param_name] = value
128
130
  end
129
131
  end
130
132
  result
@@ -26,7 +26,7 @@ module Libis
26
26
  end
27
27
 
28
28
  def logger
29
- self.properties['logger'] || (job.logger rescue nil)
29
+ self.properties[:logger] || (job.logger rescue nil)
30
30
  end
31
31
 
32
32
  end
@@ -107,6 +107,7 @@ module Libis
107
107
  o = {}
108
108
  o.merge!(opts[self.class.to_s] || {})
109
109
  o.merge!(opts[self.name] || opts[self.names.join('/')] || {})
110
+ o.key_symbols_to_strings!
110
111
 
111
112
  if o and o.is_a? Hash
112
113
  default_values.each do |name, _|
@@ -14,7 +14,7 @@ module Libis
14
14
  # @param [Libis::Workflow::Base::WorkItem] item
15
15
  def run(item)
16
16
 
17
- item.properties['ingest_failed'] = item.check_status(:FAILED)
17
+ item.properties[:ingest_failed] = item.check_status(:FAILED)
18
18
 
19
19
  item.summary = {}
20
20
  item.log_history.each do |log|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Libis
4
4
  module Workflow
5
- VERSION = '2.0.2' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
5
+ VERSION = '2.0.3' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
6
6
  end
7
7
  end
@@ -9,7 +9,7 @@ class TestDirItem < ::Libis::Workflow::DirItem
9
9
  end
10
10
 
11
11
  def name
12
- self.properties['name'] || super
12
+ self.properties[:name] || super
13
13
  end
14
14
 
15
15
  end
@@ -12,7 +12,7 @@ class TestFileItem < ::Libis::Workflow::FileItem
12
12
  end
13
13
 
14
14
  def name
15
- self.properties['name'] || super
15
+ self.properties[:name] || super
16
16
  end
17
17
 
18
18
  end
@@ -7,7 +7,7 @@ class CamelizeName < ::Libis::Workflow::Task
7
7
 
8
8
  def process(item)
9
9
  return unless (item.is_a?(TestFileItem) || item.is_a?(TestDirItem))
10
- item.properties['name'] = item.name.camelize
10
+ item.properties[:name] = item.name.camelize
11
11
  end
12
12
 
13
13
  end
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.2
4
+ version: 2.0.3
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-03-08 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler