lyber-core 6.0.0 → 6.1.0
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 +4 -4
- data/lib/lyber_core/log.rb +5 -5
- data/lib/lyber_core/return_state.rb +1 -1
- data/lib/lyber_core/robot.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1782e67d9093e1626e046f38c5952020d16664350d950ec01cda9790d4dfef4d
|
4
|
+
data.tar.gz: 8b57bb3810932c6f5ccc5d796f8ee397e0d8e6aab5a72211f29261816f65e72f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc9eb98caf13bec01711b2326dbc3d2635054669fb1c8e13577b0953939231a2c1b567b4183e73432a11fcb587335b5abef29b64a8f2b94f8f2275c9682d4ad6
|
7
|
+
data.tar.gz: 7d06278ab9fbcb5d41a48abd9c3691fb3cbf6215b484c601aa39fbf451456e1cebe469cd1df487d3608b7b81cdf882fcb080507ebd0ac583e55762b06a7b4302
|
data/lib/lyber_core/log.rb
CHANGED
@@ -92,14 +92,14 @@ module LyberCore
|
|
92
92
|
@@log.add(Logger::DEBUG) { msg }
|
93
93
|
end
|
94
94
|
|
95
|
-
def Log.exception(
|
96
|
-
msg = Log.exception_message(
|
95
|
+
def Log.exception(exc)
|
96
|
+
msg = Log.exception_message(exc)
|
97
97
|
Log.error(msg)
|
98
98
|
end
|
99
99
|
|
100
|
-
def Log.exception_message(
|
101
|
-
msg =
|
102
|
-
msg <<
|
100
|
+
def Log.exception_message(exc)
|
101
|
+
msg = exc.inspect.split($/).join('; ') + "\n"
|
102
|
+
msg << exc.backtrace.join("\n") if exc.backtrace
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -8,7 +8,7 @@ module LyberCore
|
|
8
8
|
class ReturnState
|
9
9
|
attr_reader :status
|
10
10
|
attr_accessor :note
|
11
|
-
ALLOWED_RETURN_STATES = %w[completed skipped waiting].freeze
|
11
|
+
ALLOWED_RETURN_STATES = %w[completed skipped waiting noop].freeze
|
12
12
|
DEFAULT_RETURN_STATE = 'completed'
|
13
13
|
|
14
14
|
def initialize(params = {})
|
data/lib/lyber_core/robot.rb
CHANGED
@@ -34,11 +34,14 @@ module LyberCore
|
|
34
34
|
|
35
35
|
# Sets up logging, timing and error handling of the job
|
36
36
|
# Calls the #perform method, then sets workflow to 'completed' or 'error' depending on success
|
37
|
+
# rubocop:disable Metrics/AbcSize
|
38
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
39
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
37
40
|
def work(druid)
|
38
41
|
Honeybadger.context(druid: druid, process: process, workflow_name: workflow_name) if defined? Honeybadger
|
39
42
|
workflow = workflow(druid)
|
40
43
|
LyberCore::Log.set_logfile($stdout) # let process manager(bluepill) handle logging
|
41
|
-
LyberCore::Log.info "#{druid} processing"
|
44
|
+
LyberCore::Log.info "#{druid} processing #{process} (#workflow_name)"
|
42
45
|
return if check_queued_status && !item_queued?(druid)
|
43
46
|
|
44
47
|
# this is the default note to pass back to workflow service,
|
@@ -64,7 +67,8 @@ module LyberCore
|
|
64
67
|
workflow_state = 'completed'
|
65
68
|
end
|
66
69
|
# update the workflow status from its current state to the state returned by perform (or 'completed' as the default)
|
67
|
-
workflow
|
70
|
+
# noop allows a robot to not set a workflow as complete, e.g., if that is delegated to another service.
|
71
|
+
workflow.complete(workflow_state, elapsed, note) unless workflow_state == 'noop'
|
68
72
|
|
69
73
|
LyberCore::Log.info "Finished #{druid} in #{sprintf('%0.4f', elapsed)}s"
|
70
74
|
rescue StandardError => e
|
@@ -77,6 +81,9 @@ module LyberCore
|
|
77
81
|
raise e # send exception to Resque failed queue
|
78
82
|
end
|
79
83
|
end
|
84
|
+
# rubocop:enable Metrics/AbcSize
|
85
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
86
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
80
87
|
|
81
88
|
private
|
82
89
|
|
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: 6.
|
4
|
+
version: 6.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: 2020-02-
|
19
|
+
date: 2020-02-19 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: coveralls
|