libis-workflow 2.0.beta.26 → 2.0.0

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: f38564b780dda17bf3e9b9985ac768fe47d6eda5
4
- data.tar.gz: 49d12b01cb4bf203e538ef1ce1eb656ab7267f4f
3
+ metadata.gz: 91b0c182d5d2f5214287dc2cd50eb0a7b9f4fbd3
4
+ data.tar.gz: 6c51f5afcd524d2314e05b5cf14f66aeb30e050b
5
5
  SHA512:
6
- metadata.gz: 67a4e8d9bce4f62917acd19d97779c89dbfe499f43056667151d5fa890430bcf822ccabd55035dd1612eb59911610287cd2cb585d5bf0bf2fe237bc23147e0f1
7
- data.tar.gz: 57ae40a1cd90165fc70d860c6279caeecfe5755997683103406666a43160cb5d19094c55428fd7f8da1b48b15c91ea2e45d0c7a948c5988ac9524ffa4ec5aed4
6
+ metadata.gz: c9c2b825f8ce8b5d6007975770e45694a8c6710ebc4a6f13cc37eb51810424c31867bfe8057195680893d68c8adf1e34a007c08257fbba198e5574423994a63f
7
+ data.tar.gz: 9f248db1a5e6ceb17560ed91534535783abf295e0b27130688721d7746496e91b0a77996bfcac3ec503495839f1f21a25e163d7ada667dfc5957b8e7510cf1df
@@ -3,7 +3,7 @@ module Libis
3
3
  module Base
4
4
  module Logging
5
5
 
6
- # Helper function for the Tasks to add a log entry to the log_history.
6
+ # Helper function for the WorkItems to add a log entry to the log_history.
7
7
  #
8
8
  # The supplied message structure is expected to contain the following fields:
9
9
  # - :severity : ::Logger::Severity value
@@ -39,10 +39,14 @@ module Libis
39
39
  else
40
40
  [0, '']
41
41
  end
42
- task = msg[:task] || '*UNKNOWN*'
42
+ task = msg[:task] || ''
43
43
  message_text = (message_text % args rescue "#{message_text} - #{args}")
44
44
 
45
- self.add_log severity: severity, id: message_id.to_i, text: message_text, task: task
45
+ run_id = self.get_run.id rescue nil
46
+
47
+ self.add_log severity: severity, id: message_id.to_i, text: message_text, task: task, run_id: run_id
48
+
49
+ task = "[#{run_id}] #{task}" if run_id
46
50
  name = ''
47
51
  begin
48
52
  name = self.to_s
@@ -51,7 +55,9 @@ module Libis
51
55
  rescue
52
56
  # do nothing
53
57
  end
54
- Config.logger.add(severity, message_text, ('%s - %s ' % [task, name]))
58
+
59
+ logger = self.get_run.logger rescue Config.logger
60
+ logger.add(severity, message_text, ('%s - %s ' % [task, name]))
55
61
  end
56
62
 
57
63
  protected
@@ -15,6 +15,7 @@ module Libis
15
15
  #
16
16
  # - start_date: [Time] the timestamp of the execution of the run
17
17
  # - job: [Object] a reference to the Job this Run belongs to
18
+ # - id: [String] (Optional) a unique run number
18
19
  #
19
20
  # Note that ::Libis::Workflow::Base::WorkItem is a parent module and therefore requires implementation of the
20
21
  # attributes of that module too.
@@ -20,6 +20,10 @@ module Libis
20
20
  @run_object = ::Libis::Workflow::Run.new
21
21
  end
22
22
 
23
+ def logger
24
+ Config.logger
25
+ end
26
+
23
27
  end
24
28
 
25
29
  end
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ require 'securerandom'
2
2
 
3
3
  require 'libis/workflow/config'
4
4
  require 'libis/workflow/workflow'
@@ -12,14 +12,23 @@ module Libis
12
12
  class Run < ::Libis::Workflow::WorkItem
13
13
  include ::Libis::Workflow::Base::Run
14
14
 
15
- attr_accessor :start_date, :job
15
+ attr_accessor :start_date, :job, :id
16
16
 
17
17
  def initialize
18
18
  @start_date = Time.now
19
19
  @job = nil
20
+ @id = SecureRandom.hex(10)
20
21
  super
21
22
  end
22
23
 
24
+ def id
25
+ nil
26
+ end
27
+
28
+ def logger
29
+ self.properties['logger'] || (job.logger rescue nil)
30
+ end
31
+
23
32
  end
24
33
 
25
34
  end
@@ -174,7 +174,7 @@ module Libis
174
174
 
175
175
  def substatus_check(status, item, task_or_item)
176
176
  if (failed = status[:FAILED]) > 0
177
- warn "%d sub#{task_or_item}(s) failed", item, failed
177
+ error "%d sub#{task_or_item}(s) failed", item, failed
178
178
  update_status(item, :FAILED)
179
179
  end
180
180
 
@@ -184,7 +184,7 @@ module Libis
184
184
  end
185
185
 
186
186
  if (waiting = status[:ASYNC_WAIT]) > 0
187
- warn "waiting for %d sub#{task_or_item}(s) in async process", item, waiting
187
+ info "waiting for %d sub#{task_or_item}(s) in async process", item, waiting
188
188
  update_status(item, :ASYNC_WAIT)
189
189
  end
190
190
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Libis
4
4
  module Workflow
5
- VERSION = '2.0.beta.26' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
5
+ VERSION = '2.0.0' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
6
6
  end
7
7
  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.beta.26
4
+ version: 2.0.0
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-01-26 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -174,9 +174,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  requirements:
177
- - - ">"
177
+ - - ">="
178
178
  - !ruby/object:Gem::Version
179
- version: 1.3.1
179
+ version: '0'
180
180
  requirements: []
181
181
  rubyforge_project:
182
182
  rubygems_version: 2.4.8