lyber-core 5.0.1 → 5.1.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
  SHA256:
3
- metadata.gz: a532bd8bf6ab196b5f24fe35a1595324f0329e9699eb1a7ffcbcf6ca1e056457
4
- data.tar.gz: dbe985ed328eeec63f67a22a473c0a72ab64109e1d80e6df89618518e2f66101
3
+ metadata.gz: 2d156c9fe696a673d0bb1cea7e86b41975a4cca98e1649a3cdea5daa54a8781c
4
+ data.tar.gz: 705b162c8a6dc5599ad536a6264cb20222bf8570e2284645b16c47e3b348fdc4
5
5
  SHA512:
6
- metadata.gz: 95d7cb92742786e696428701ff5aa81f977d9051639ab4987a8c7d6f3f6f99d4a214204fed3d3cf4b62fc83a1221ab71419de2ac064cee6039ad55f7988cfa11
7
- data.tar.gz: b91a95ed0807613a873780b2eb204cad8925c3f08a600e0cca5e7e3cd4700888a4a413959a75d6a866c5c9a4bc8ab422f7e858555bb836475505ec0b5d4cf691
6
+ metadata.gz: d8d2c39856794c200f6da4b1504ef036f044a4ed070bb7ed8bf9a4598ea8d3a2a9d0998463664eba9099f2e9703238dede98b7d78416eb5932eca650bb85d083
7
+ data.tar.gz: a17cf339a031bc7aa18873706bcf67eddd97efaf62a74fdb4b39d91c35bcf8ab985d5b650a68519147d95ae22f0c13ea1af2cf3b0b9eddc291e797c591e305cc
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- [![Build Status](https://travis-ci.org/sul-dlss/lyber-core.svg?branch=master)](https://travis-ci.org/sul-dlss/lyber-core) | [![Coverage Status](https://coveralls.io/repos/github/sul-dlss/lyber-core/badge.svg?branch=master)](https://coveralls.io/github/sul-dlss/lyber-core?branch=master)
1
+ [![Build Status](https://travis-ci.org/sul-dlss/lyber-core.svg?branch=master)](https://travis-ci.org/sul-dlss/lyber-core)
2
+ [![Coverage Status](https://coveralls.io/repos/github/sul-dlss/lyber-core/badge.svg?branch=master)](https://coveralls.io/github/sul-dlss/lyber-core?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/lyber-core.svg)](https://badge.fury.io/rb/lyber-core)
2
4
 
3
5
  # lyber_core
4
6
 
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lyber_core'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dor-services'
2
4
  require 'lyber_core/log'
3
5
  require 'lyber_core/robot'
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LyberCore
2
4
  class LyberCore::Log
3
5
  require 'logger'
4
6
 
5
7
  # Default values
6
- DEFAULT_LOGFILE = '/tmp/lybercore_log.log'.freeze # TODO change to STDOUT?
8
+ DEFAULT_LOGFILE = '/tmp/lybercore_log.log' # TODO: change to STDOUT?
7
9
  DEFAULT_LOG_LEVEL = Logger::INFO
8
10
  DEFAULT_FORMATTER = proc do |s, t, p, m|
9
11
  "%5s [%s] (%s) %s :: %s\n" % [s, t.strftime('%Y-%m-%d %H:%M:%S'), $$, p, m]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # this object defines the allowed states robots can optionally return upon completion
2
4
  # if the return value of the "perform" step is an object of this type and the status value is set an allowed value,
3
5
  # it will be used to set the final workflow state for that druid
@@ -7,7 +9,7 @@ module LyberCore
7
9
  attr_reader :status
8
10
  attr_accessor :note
9
11
  ALLOWED_RETURN_STATES = %w[completed skipped waiting].freeze
10
- DEFAULT_RETURN_STATE = 'completed'.freeze
12
+ DEFAULT_RETURN_STATE = 'completed'
11
13
 
12
14
  def self.SKIPPED
13
15
  new(status: 'skipped')
@@ -29,6 +31,7 @@ module LyberCore
29
31
  def status=(value)
30
32
  state = value.to_s.downcase
31
33
  raise 'invalid return state' unless ALLOWED_RETURN_STATES.include? state
34
+
32
35
  @status = state
33
36
  end
34
37
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'benchmark'
2
4
  require 'active_support'
3
5
  require 'active_support/core_ext'
@@ -79,16 +81,16 @@ module LyberCore
79
81
  workflow_state = 'completed'
80
82
  end
81
83
  # update the workflow status from its current state to the state returned by perform (or 'completed' as the default)
82
- workflow_service.update_workflow_status(@repo, druid, @workflow_name, @step_name, workflow_state, elapsed: elapsed, note: note)
84
+ workflow_service.update_status(druid: druid, workflow: @workflow_name, process: @step_name, status: workflow_state, elapsed: elapsed, note: note)
83
85
  LyberCore::Log.info "Finished #{druid} in #{sprintf('%0.4f', elapsed)}s"
84
86
  rescue StandardError => e
85
87
  Honeybadger.notify(e) if defined? Honeybadger
86
88
  begin
87
89
  LyberCore::Log.error e.message + "\n" + e.backtrace.join("\n")
88
90
  workflow_service.update_workflow_error_status(@repo, druid, @workflow_name, @step_name, e.message, error_text: Socket.gethostname)
89
- rescue StandardError => e2
90
- LyberCore::Log.error "Cannot set #{druid} to status='error'\n" + e2.message + "\n" + e2.backtrace.join("\n")
91
- raise e2 # send exception to Resque failed queue
91
+ rescue StandardError => e
92
+ LyberCore::Log.error "Cannot set #{druid} to status='error'\n" + e.message + "\n" + e.backtrace.join("\n")
93
+ raise e # send exception to Resque failed queue
92
94
  end
93
95
  end
94
96
 
@@ -97,6 +99,7 @@ module LyberCore
97
99
  def item_queued?(druid)
98
100
  status = workflow_service.workflow_status(@repo, druid, @workflow_name, @step_name)
99
101
  return true if status =~ /queued/i
102
+
100
103
  LyberCore::Log.warn "Item #{druid} is not queued, but has status of '#{status}'. Will skip processing"
101
104
  false
102
105
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc 'Generate RDoc'
2
4
  task doc: ['doc:generate']
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lyber-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alpana Pande
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2019-05-14 00:00:00.000000000 Z
19
+ date: 2019-09-16 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activesupport
@@ -34,18 +34,38 @@ dependencies:
34
34
  version: '0'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: dor-services
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 7.0.0
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: '9'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 7.0.0
52
+ - - "<"
53
+ - !ruby/object:Gem::Version
54
+ version: '9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dor-workflow-client
37
57
  requirement: !ruby/object:Gem::Requirement
38
58
  requirements:
39
59
  - - "~>"
40
60
  - !ruby/object:Gem::Version
41
- version: '7.0'
61
+ version: '3.7'
42
62
  type: :runtime
43
63
  prerelease: false
44
64
  version_requirements: !ruby/object:Gem::Requirement
45
65
  requirements:
46
66
  - - "~>"
47
67
  - !ruby/object:Gem::Version
48
- version: '7.0'
68
+ version: '3.7'
49
69
  - !ruby/object:Gem::Dependency
50
70
  name: coveralls
51
71
  requirement: !ruby/object:Gem::Requirement
@@ -180,8 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
200
  - !ruby/object:Gem::Version
181
201
  version: 1.3.6
182
202
  requirements: []
183
- rubyforge_project:
184
- rubygems_version: 2.7.6
203
+ rubygems_version: 3.0.3
185
204
  signing_key:
186
205
  specification_version: 4
187
206
  summary: Core services used by the SUL Digital Library