lyber-core 7.4.1 → 7.5.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: 88acb55427197de0577cf0d7f8438638de596f42a70b7ad9feeb2f6c78c8e3f7
4
- data.tar.gz: 303682017a51e90b3d4abb2843e903c42ca622bb3020b5ae6eaceb307eabf399
3
+ metadata.gz: 4e631494dfd0e92ddb58b8a92f9414d6ab8b3861d7cb831dc0a2166cc0a097e1
4
+ data.tar.gz: c0177b4b844a61a15eed8ab50ab16264dd28faecd13eaa15c0afaadab05d256a
5
5
  SHA512:
6
- metadata.gz: ad5d5b0ce4cdfbee767e96c6c563045c64f229abb4eaa9f92c2e209edabc1967ec7fb41ecd81915369d4c693d3f71680459ace8b1f535f89156d07cbfa49994f
7
- data.tar.gz: 0d7abbe5548a45117f53bf4b0097fa2604c2eebc33723db7766f8e2aece2cce43c78f988d79f3ef31991ceb32583e17619e371e8c7a97808e1cd44294b570d60
6
+ metadata.gz: 1197fbc8f99343df897746a9289e1eeabf56e80d43d7a37ff861fb5997fe8a57774ca7149b34f12ad38b4172a7f1f9fc891e85b9fbbdba84a7f02b236ef2ba8d
7
+ data.tar.gz: 32d345176540a0e35bed7f41309cb481ead4e0d40d7d068ed4b9b3ce20610cb5258d89201f4f228e0d01eb2c0578140525a170ccea60a20b2fb85d61e17c8328
@@ -8,16 +8,18 @@ module LyberCore
8
8
  sidekiq_options retry: 0
9
9
 
10
10
  attr_reader :workflow_name, :process, :druid
11
+ attr_accessor :check_queued_status
11
12
 
12
13
  delegate :lane_id, to: :workflow
13
14
 
14
- def initialize(workflow_name, process)
15
+ def initialize(workflow_name, process, check_queued_status: true)
15
16
  @workflow_name = workflow_name
16
17
  @process = process
18
+ @check_queued_status = check_queued_status
17
19
  end
18
20
 
19
21
  def workflow_service
20
- @workflow_service ||= WorkflowClientFactory.build(logger: logger)
22
+ @workflow_service ||= WorkflowClientFactory.build(logger:)
21
23
  end
22
24
 
23
25
  def object_client
@@ -38,7 +40,7 @@ module LyberCore
38
40
  # rubocop:disable Metrics/MethodLength
39
41
  def perform(druid)
40
42
  @druid = druid
41
- Honeybadger.context(druid: druid, process: process, workflow_name: workflow_name)
43
+ Honeybadger.context(druid:, process:, workflow_name:)
42
44
 
43
45
  logger.info "#{druid} processing #{process} (#{workflow_name})"
44
46
  return unless check_item_queued?
@@ -101,13 +103,15 @@ module LyberCore
101
103
  # rubocop:enable Metrics/AbcSize
102
104
 
103
105
  def workflow
104
- @workflow ||= Workflow.new(workflow_service: workflow_service,
105
- druid: druid,
106
- workflow_name: workflow_name,
107
- process: process)
106
+ @workflow ||= Workflow.new(workflow_service:,
107
+ druid:,
108
+ workflow_name:,
109
+ process:)
108
110
  end
109
111
 
110
112
  def check_item_queued?
113
+ return true unless check_queued_status
114
+
111
115
  return true if /queued/i.match?(workflow.status)
112
116
 
113
117
  msg = "Item #{druid} is not queued for #{process} (#{workflow_name}), " \
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LyberCore
4
- VERSION = '7.4.1'
4
+ VERSION = '7.5.0'
5
5
  end
@@ -11,39 +11,46 @@ module LyberCore
11
11
  end
12
12
 
13
13
  def start!(note)
14
- workflow_service.update_status(druid: druid,
14
+ workflow_service.update_status(druid:,
15
15
  workflow: workflow_name,
16
- process: process,
16
+ process:,
17
17
  status: 'started',
18
18
  elapsed: 1.0,
19
- note: note)
19
+ note:)
20
20
  end
21
21
 
22
22
  def complete!(status, elapsed, note)
23
- workflow_service.update_status(druid: druid,
23
+ workflow_service.update_status(druid:,
24
24
  workflow: workflow_name,
25
- process: process,
26
- status: status,
27
- elapsed: elapsed,
28
- note: note)
25
+ process:,
26
+ status:,
27
+ elapsed:,
28
+ note:)
29
29
  end
30
30
 
31
31
  def error!(error_msg, error_text)
32
- workflow_service.update_error_status(druid: druid,
32
+ workflow_service.update_error_status(druid:,
33
33
  workflow: workflow_name,
34
- process: process,
35
- error_msg: error_msg,
36
- error_text: error_text)
34
+ process:,
35
+ error_msg:,
36
+ error_text:)
37
+ end
38
+
39
+ # @return [Hash] any workflow context associated with the workflow
40
+ def context
41
+ @context ||= workflow_service.process(pid: druid,
42
+ workflow_name:,
43
+ process:).context
37
44
  end
38
45
 
39
46
  def status
40
- @status ||= workflow_service.workflow_status(druid: druid,
47
+ @status ||= workflow_service.workflow_status(druid:,
41
48
  workflow: workflow_name,
42
- process: process)
49
+ process:)
43
50
  end
44
51
 
45
52
  def lane_id
46
- @lane_id ||= workflow_service.process(pid: druid, workflow_name: workflow_name, process: process).lane_id
53
+ @lane_id ||= workflow_service.process(pid: druid, workflow_name:, process:).lane_id
47
54
  end
48
55
 
49
56
  private
@@ -4,7 +4,7 @@ module LyberCore
4
4
  # Factory for creating a workflow client
5
5
  class WorkflowClientFactory
6
6
  def self.build(logger:)
7
- Dor::Workflow::Client.new(url: Settings.workflow.url, logger: logger, timeout: Settings.workflow.timeout)
7
+ Dor::Workflow::Client.new(url: Settings.workflow.url, logger:, timeout: Settings.workflow.timeout)
8
8
  end
9
9
  end
10
10
  end
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: 7.4.1
4
+ version: 7.5.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: 2024-01-16 00:00:00.000000000 Z
19
+ date: 2024-05-06 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activesupport
@@ -66,14 +66,14 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: '7.4'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '7.4'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: druid-tools
79
79
  requirement: !ruby/object:Gem::Requirement
@@ -232,14 +232,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  requirements:
233
233
  - - ">="
234
234
  - !ruby/object:Gem::Version
235
- version: '3.0'
235
+ version: '3.2'
236
236
  required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  requirements:
238
238
  - - ">="
239
239
  - !ruby/object:Gem::Version
240
240
  version: 1.3.6
241
241
  requirements: []
242
- rubygems_version: 3.3.7
242
+ rubygems_version: 3.5.9
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: Core services used by the SUL Digital Library