dor-workflow-client 5.1.0 → 7.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
  SHA256:
3
- metadata.gz: c58569c11d2c599671ecf4fef09158bdf37191c93c4193d96d2e6be614d9eeaa
4
- data.tar.gz: ce8f53542aede57b9386ec769673fac4af7a92d9bb32b2c9a00ba9fe59ae6754
3
+ metadata.gz: aed52be59d8bdd07de43af3d484e04d7d0aefa98dd8a8813840401a1cd06978c
4
+ data.tar.gz: d81de9c43e0bc80eb50b02048422a399f77dc2a450db8ecf5aec165cdcc18251
5
5
  SHA512:
6
- metadata.gz: e09e2e40204d869c31ce832509ccf4582d98823cd767348966789a5961bfb2ae3b67b148a35a41f734fb782100bef10619e36a1f44e244a70685d3a1d6613f90
7
- data.tar.gz: 2ddd5435a3f7738a48800182c46e1d243bf9bdaf457d367f7f26d0a7868c61005f853850a18aba61c97475c74bf297b08060fc7a51fdadd76161d90b4287cebc
6
+ metadata.gz: 672a4500292b005090dddf14ab56bdb8adfc981badaf2840e7c9439d84b996143aa047fbe1948efb9aa2c5b22c188ce02ee8929814fc9a4d072a6bd5aec4d6bd
7
+ data.tar.gz: 2ede4f3978b2f7e27fc405146b9f106bddd7b9f787c4eb26295ee09fff2c1b7be02145da55f6f9ddae93de7da36c20709116114484da59e4adcc61f55bcc2fd7
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@3.1.2
3
+ ruby-rails: sul-dlss/ruby-rails@4.1.0
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/.rubocop.yml CHANGED
@@ -1,17 +1,37 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require:
4
+ - rubocop-rake
5
+ - rubocop-rspec
6
+
3
7
  AllCops:
4
8
  TargetRubyVersion: 3.0
5
- # Configuration parameters: AllowURI, URISchemes.
9
+ # Configuration parameters: AllowURI, URISchemes.
10
+ Exclude:
11
+ - 'vendor/**/*'
12
+
13
+
6
14
  Layout/LineLength:
7
15
  Max: 300
8
16
 
17
+ Lint/UnusedBlockArgument:
18
+ AllowUnusedKeywordArguments: true
19
+
9
20
  Metrics/BlockLength:
10
21
  Exclude:
11
22
  - spec/**/*_spec.rb
12
23
 
13
- Lint/UnusedBlockArgument:
14
- AllowUnusedKeywordArguments: true
24
+ RSpec/ExampleLength:
25
+ Max: 10
26
+
27
+ RSpec/MultipleMemoizedHelpers:
28
+ Enabled: false
29
+
30
+ RSpec/MultipleExpectations:
31
+ Enabled: false
32
+
33
+ RSpec/NestedGroups:
34
+ Max: 4
15
35
 
16
36
  Gemspec/DeprecatedAttributeAssignment: # new in 1.10
17
37
  Enabled: true
@@ -143,4 +163,139 @@ Style/NestedFileDirname: # new in 1.26
143
163
  Style/ObjectThen: # new in 1.28
144
164
  Enabled: true
145
165
  Style/RedundantInitialize: # new in 1.27
146
- Enabled: true
166
+ Enabled: true
167
+
168
+ Lint/DuplicateMagicComment: # new in 1.37
169
+ Enabled: true
170
+ Lint/DuplicateMatchPattern: # new in 1.50
171
+ Enabled: true
172
+ Lint/UselessRescue: # new in 1.43
173
+ Enabled: true
174
+ Metrics/CollectionLiteralLength: # new in 1.47
175
+ Enabled: true
176
+ Style/ArrayIntersect: # new in 1.40
177
+ Enabled: true
178
+ Style/ComparableClamp: # new in 1.44
179
+ Enabled: true
180
+ Style/ConcatArrayLiterals: # new in 1.41
181
+ Enabled: true
182
+ Style/DataInheritance: # new in 1.49
183
+ Enabled: true
184
+ Style/DirEmpty: # new in 1.48
185
+ Enabled: true
186
+ Style/ExactRegexpMatch: # new in 1.51
187
+ Enabled: true
188
+ Style/FileEmpty: # new in 1.48
189
+ Enabled: true
190
+ Style/MagicCommentFormat: # new in 1.35
191
+ Enabled: true
192
+ Style/MapToSet: # new in 1.42
193
+ Enabled: true
194
+ Style/MinMaxComparison: # new in 1.42
195
+ Enabled: true
196
+ Style/OperatorMethodCall: # new in 1.37
197
+ Enabled: true
198
+ Style/RedundantArrayConstructor: # new in 1.52
199
+ Enabled: true
200
+ Style/RedundantConstantBase: # new in 1.40
201
+ Enabled: true
202
+ Style/RedundantDoubleSplatHashBraces: # new in 1.41
203
+ Enabled: true
204
+ Style/RedundantEach: # new in 1.38
205
+ Enabled: true
206
+ Style/RedundantFilterChain: # new in 1.52
207
+ Enabled: true
208
+ Style/RedundantHeredocDelimiterQuotes: # new in 1.45
209
+ Enabled: true
210
+ Style/RedundantLineContinuation: # new in 1.49
211
+ Enabled: true
212
+ Style/RedundantRegexpConstructor: # new in 1.52
213
+ Enabled: true
214
+ Style/RedundantStringEscape: # new in 1.37
215
+ Enabled: true
216
+
217
+ Capybara/MatchStyle: # new in 2.17
218
+ Enabled: true
219
+ Capybara/NegationMatcher: # new in 2.14
220
+ Enabled: true
221
+ Capybara/SpecificActions: # new in 2.14
222
+ Enabled: true
223
+ Capybara/SpecificFinders: # new in 2.13
224
+ Enabled: true
225
+ Capybara/SpecificMatcher: # new in 2.12
226
+ Enabled: true
227
+ FactoryBot/AssociationStyle: # new in 2.23
228
+ Enabled: true
229
+ FactoryBot/ConsistentParenthesesStyle: # new in 2.14
230
+ Enabled: true
231
+ FactoryBot/FactoryAssociationWithStrategy: # new in 2.23
232
+ Enabled: true
233
+ FactoryBot/FactoryNameStyle: # new in 2.16
234
+ Enabled: true
235
+ FactoryBot/RedundantFactoryOption: # new in 2.23
236
+ Enabled: true
237
+ FactoryBot/SyntaxMethods: # new in 2.7
238
+ Enabled: true
239
+ RSpec/BeEmpty: # new in 2.20
240
+ Enabled: true
241
+ RSpec/BeEq: # new in 2.9.0
242
+ Enabled: true
243
+ RSpec/BeNil: # new in 2.9.0
244
+ Enabled: true
245
+ RSpec/ChangeByZero: # new in 2.11
246
+ Enabled: true
247
+ RSpec/ContainExactly: # new in 2.19
248
+ Enabled: true
249
+ RSpec/DuplicatedMetadata: # new in 2.16
250
+ Enabled: true
251
+ RSpec/ExcessiveDocstringSpacing: # new in 2.5
252
+ Enabled: true
253
+ RSpec/IdenticalEqualityAssertion: # new in 2.4
254
+ Enabled: true
255
+ RSpec/IndexedLet: # new in 2.20
256
+ Enabled: true
257
+ RSpec/MatchArray: # new in 2.19
258
+ Enabled: true
259
+ RSpec/NoExpectationExample: # new in 2.13
260
+ Enabled: true
261
+ RSpec/PendingWithoutReason: # new in 2.16
262
+ Enabled: true
263
+ RSpec/RedundantAround: # new in 2.19
264
+ Enabled: true
265
+ RSpec/SkipBlockInsideExample: # new in 2.19
266
+ Enabled: true
267
+ RSpec/SortMetadata: # new in 2.14
268
+ Enabled: true
269
+ RSpec/SubjectDeclaration: # new in 2.5
270
+ Enabled: true
271
+ RSpec/VerifiedDoubleReference: # new in 2.10.0
272
+ Enabled: true
273
+ RSpec/Rails/AvoidSetupHook: # new in 2.4
274
+ Enabled: true
275
+ RSpec/Rails/HaveHttpStatus: # new in 2.12
276
+ Enabled: true
277
+ RSpec/Rails/InferredSpecType: # new in 2.14
278
+ Enabled: true
279
+ RSpec/Rails/MinitestAssertions: # new in 2.17
280
+ Enabled: true
281
+ RSpec/Rails/TravelAround: # new in 2.19
282
+ Enabled: true
283
+
284
+ Gemspec/DevelopmentDependencies: # new in 1.44
285
+ Enabled: true
286
+ Lint/MixedCaseRange: # new in 1.53
287
+ Enabled: true
288
+ Lint/RedundantRegexpQuantifiers: # new in 1.53
289
+ Enabled: true
290
+ Style/RedundantCurrentDirectoryInPath: # new in 1.53
291
+ Enabled: true
292
+ Style/RedundantRegexpArgument: # new in 1.53
293
+ Enabled: true
294
+ Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
295
+ Enabled: true
296
+ Style/YAMLFileRead: # new in 1.53
297
+ Enabled: true
298
+ RSpec/ReceiveMessages: # new in 2.23
299
+ Enabled: true
300
+ RSpec/Rails/NegationBeValid: # new in 2.23
301
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,58 +1,40 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2022-06-28 04:56:14 UTC using RuboCop version 1.31.0.
2
+ # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
+ # on 2023-08-23 21:27:28 UTC using RuboCop version 1.56.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
13
- Exclude:
14
- - 'dor-workflow-client.gemspec'
15
-
16
- # Offense count: 1
17
- # Configuration parameters: AllowComments, AllowEmptyLambdas.
18
- Lint/EmptyBlock:
19
- Exclude:
20
- - 'spec/workflow/client/workflow_routes_spec.rb'
21
-
22
- # Offense count: 1
23
- Lint/NoReturnInBeginEndBlocks:
24
- Exclude:
25
- - 'lib/dor/workflow/client/status.rb'
26
-
27
- # Offense count: 5
28
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
29
- Metrics/AbcSize:
30
- Max: 23
31
-
32
9
  # Offense count: 2
33
- # Configuration parameters: IgnoredMethods.
34
- Metrics/CyclomaticComplexity:
35
- Max: 8
10
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
11
+ Metrics/AbcSize:
12
+ Exclude:
13
+ - 'lib/dor/workflow/client/connection_factory.rb'
14
+ - 'lib/dor/workflow/client/queues.rb'
36
15
 
37
16
  # Offense count: 2
38
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
17
+ # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
39
18
  Metrics/MethodLength:
40
- Max: 19
41
-
42
- # Offense count: 3
43
- # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
44
- Metrics/ParameterLists:
45
- Max: 8
19
+ Exclude:
20
+ - 'lib/dor/workflow/client/connection_factory.rb'
21
+ - 'lib/dor/workflow/client/queues.rb'
46
22
 
47
23
  # Offense count: 1
48
- # This cop supports safe autocorrection (--autocorrect).
49
- Style/KeywordParametersOrder:
24
+ # Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
25
+ Metrics/ParameterLists:
50
26
  Exclude:
51
27
  - 'lib/dor/workflow/client/workflow_routes.rb'
52
28
 
53
- # Offense count: 1
54
- # This cop supports safe autocorrection (--autocorrect).
55
- # Configuration parameters: AllowModifier.
56
- Style/SoleNestedConditional:
29
+ # Offense count: 73
30
+ # Configuration parameters: AssignmentOnly.
31
+ RSpec/InstanceVariable:
32
+ Exclude:
33
+ - 'spec/dor/workflow/client_spec.rb'
34
+
35
+ # Offense count: 7
36
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
37
+ RSpec/VerifiedDoubles:
57
38
  Exclude:
58
- - 'lib/dor/workflow/client/status.rb'
39
+ - 'spec/dor/workflow/client/connection_factory_spec.rb'
40
+ - 'spec/dor/workflow/client_spec.rb'
data/Gemfile CHANGED
@@ -11,3 +11,14 @@ group :development, :test do
11
11
  gem 'byebug'
12
12
  gem 'rspec_junit_formatter' # For CircleCI
13
13
  end
14
+
15
+ group :development do
16
+ gem 'rake'
17
+ gem 'rspec', '~> 3.3'
18
+ gem 'rubocop', '~> 1.24'
19
+ gem 'rubocop-rake'
20
+ gem 'rubocop-rspec', '~> 2.1'
21
+ gem 'simplecov'
22
+ gem 'webmock'
23
+ gem 'yard'
24
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-workflow-client (5.1.0)
4
+ dor-workflow-client (7.0.0)
5
5
  activesupport (>= 3.2.1, < 8)
6
6
  deprecation (>= 0.99.0)
7
7
  faraday (~> 2.0)
@@ -12,96 +12,117 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (7.0.3.1)
15
+ activesupport (7.1.2)
16
+ base64
17
+ bigdecimal
16
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ connection_pool (>= 2.2.5)
20
+ drb
17
21
  i18n (>= 1.6, < 2)
18
22
  minitest (>= 5.1)
23
+ mutex_m
19
24
  tzinfo (~> 2.0)
20
- addressable (2.8.0)
21
- public_suffix (>= 2.0.2, < 5.0)
25
+ addressable (2.8.6)
26
+ public_suffix (>= 2.0.2, < 6.0)
22
27
  ast (2.4.2)
28
+ base64 (0.2.0)
29
+ bigdecimal (3.1.5)
23
30
  byebug (11.1.3)
24
- concurrent-ruby (1.1.10)
31
+ concurrent-ruby (1.2.2)
32
+ connection_pool (2.4.1)
25
33
  crack (0.4.5)
26
34
  rexml
27
35
  deprecation (1.1.0)
28
36
  activesupport
29
37
  diff-lcs (1.5.0)
30
38
  docile (1.4.0)
31
- faraday (2.4.0)
32
- faraday-net_http (~> 2.0)
33
- ruby2_keywords (>= 0.0.4)
34
- faraday-net_http (2.1.0)
35
- faraday-retry (2.0.0)
39
+ drb (2.2.0)
40
+ ruby2_keywords
41
+ faraday (2.9.0)
42
+ faraday-net_http (>= 2.0, < 3.2)
43
+ faraday-net_http (3.1.0)
44
+ net-http
45
+ faraday-retry (2.2.0)
36
46
  faraday (~> 2.0)
37
- hashdiff (1.0.1)
38
- i18n (1.12.0)
47
+ hashdiff (1.1.0)
48
+ i18n (1.14.1)
39
49
  concurrent-ruby (~> 1.0)
40
- json (2.6.2)
41
- mini_portile2 (2.8.0)
42
- minitest (5.16.2)
43
- nokogiri (1.13.8)
44
- mini_portile2 (~> 2.8.0)
50
+ json (2.7.1)
51
+ language_server-protocol (3.17.0.3)
52
+ mini_portile2 (2.8.5)
53
+ minitest (5.21.1)
54
+ mutex_m (0.2.0)
55
+ net-http (0.4.1)
56
+ uri
57
+ nokogiri (1.16.0)
58
+ mini_portile2 (~> 2.8.2)
45
59
  racc (~> 1.4)
46
- parallel (1.22.1)
47
- parser (3.1.2.0)
60
+ parallel (1.24.0)
61
+ parser (3.3.0.3)
48
62
  ast (~> 2.4.1)
49
- public_suffix (4.0.7)
50
- racc (1.6.0)
63
+ racc
64
+ public_suffix (5.0.4)
65
+ racc (1.7.3)
51
66
  rainbow (3.1.1)
52
- rake (13.0.6)
53
- regexp_parser (2.5.0)
54
- rexml (3.2.5)
55
- rspec (3.11.0)
56
- rspec-core (~> 3.11.0)
57
- rspec-expectations (~> 3.11.0)
58
- rspec-mocks (~> 3.11.0)
59
- rspec-core (3.11.0)
60
- rspec-support (~> 3.11.0)
61
- rspec-expectations (3.11.0)
67
+ rake (13.1.0)
68
+ regexp_parser (2.9.0)
69
+ rexml (3.2.6)
70
+ rspec (3.12.0)
71
+ rspec-core (~> 3.12.0)
72
+ rspec-expectations (~> 3.12.0)
73
+ rspec-mocks (~> 3.12.0)
74
+ rspec-core (3.12.2)
75
+ rspec-support (~> 3.12.0)
76
+ rspec-expectations (3.12.3)
62
77
  diff-lcs (>= 1.2.0, < 2.0)
63
- rspec-support (~> 3.11.0)
64
- rspec-mocks (3.11.1)
78
+ rspec-support (~> 3.12.0)
79
+ rspec-mocks (3.12.6)
65
80
  diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.11.0)
67
- rspec-support (3.11.0)
68
- rspec_junit_formatter (0.5.1)
81
+ rspec-support (~> 3.12.0)
82
+ rspec-support (3.12.1)
83
+ rspec_junit_formatter (0.6.0)
69
84
  rspec-core (>= 2, < 4, != 2.12.0)
70
- rubocop (1.33.0)
85
+ rubocop (1.60.0)
71
86
  json (~> 2.3)
87
+ language_server-protocol (>= 3.17.0)
72
88
  parallel (~> 1.10)
73
- parser (>= 3.1.0.0)
89
+ parser (>= 3.3.0.2)
74
90
  rainbow (>= 2.2.2, < 4.0)
75
91
  regexp_parser (>= 1.8, < 3.0)
76
92
  rexml (>= 3.2.5, < 4.0)
77
- rubocop-ast (>= 1.19.1, < 2.0)
93
+ rubocop-ast (>= 1.30.0, < 2.0)
78
94
  ruby-progressbar (~> 1.7)
79
- unicode-display_width (>= 1.4.0, < 3.0)
80
- rubocop-ast (1.19.1)
81
- parser (>= 3.1.1.0)
95
+ unicode-display_width (>= 2.4.0, < 3.0)
96
+ rubocop-ast (1.30.0)
97
+ parser (>= 3.2.1.0)
98
+ rubocop-capybara (2.20.0)
99
+ rubocop (~> 1.41)
100
+ rubocop-factory_bot (2.25.1)
101
+ rubocop (~> 1.41)
82
102
  rubocop-rake (0.6.0)
83
103
  rubocop (~> 1.0)
84
- rubocop-rspec (2.12.1)
85
- rubocop (~> 1.31)
86
- ruby-progressbar (1.11.0)
104
+ rubocop-rspec (2.26.1)
105
+ rubocop (~> 1.40)
106
+ rubocop-capybara (~> 2.17)
107
+ rubocop-factory_bot (~> 2.22)
108
+ ruby-progressbar (1.13.0)
87
109
  ruby2_keywords (0.0.5)
88
- simplecov (0.21.2)
110
+ simplecov (0.22.0)
89
111
  docile (~> 1.1)
90
112
  simplecov-html (~> 0.11)
91
113
  simplecov_json_formatter (~> 0.1)
92
114
  simplecov-html (0.12.3)
93
115
  simplecov_json_formatter (0.1.4)
94
- tzinfo (2.0.5)
116
+ tzinfo (2.0.6)
95
117
  concurrent-ruby (~> 1.0)
96
- unicode-display_width (2.2.0)
97
- webmock (3.16.0)
118
+ unicode-display_width (2.5.0)
119
+ uri (0.13.0)
120
+ webmock (3.19.1)
98
121
  addressable (>= 2.8.0)
99
122
  crack (>= 0.3.2)
100
123
  hashdiff (>= 0.4.0, < 2.0.0)
101
- webrick (1.7.0)
102
- yard (0.9.28)
103
- webrick (~> 1.7.0)
104
- zeitwerk (2.6.0)
124
+ yard (0.9.34)
125
+ zeitwerk (2.6.12)
105
126
 
106
127
  PLATFORMS
107
128
  ruby
@@ -120,4 +141,4 @@ DEPENDENCIES
120
141
  yard
121
142
 
122
143
  BUNDLED WITH
123
- 2.3.17
144
+ 2.4.13
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
 
16
16
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
17
  gem.require_paths = ['lib']
18
- gem.required_ruby_version = '>= 2.7'
18
+ gem.required_ruby_version = '>= 3.0'
19
19
 
20
20
  gem.add_dependency 'activesupport', '>= 3.2.1', '< 8'
21
21
  gem.add_dependency 'deprecation', '>= 0.99.0'
@@ -25,13 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency 'nokogiri', '~> 1.6'
26
26
  gem.add_dependency 'zeitwerk', '~> 2.1'
27
27
 
28
- gem.add_development_dependency 'rake'
29
- gem.add_development_dependency 'rspec', '~> 3.3'
30
- gem.add_development_dependency 'rubocop', '~> 1.24'
31
- gem.add_development_dependency 'rubocop-rake'
32
- gem.add_development_dependency 'rubocop-rspec', '~> 2.1'
33
- gem.add_development_dependency 'simplecov'
34
- gem.add_development_dependency 'webmock'
35
- gem.add_development_dependency 'yard'
36
28
  gem.metadata['rubygems_mfa_required'] = 'true'
37
29
  end
@@ -20,30 +20,6 @@ module Dor
20
20
  doc.xpath('/lanes/lane').map { |n| n['id'] }
21
21
  end
22
22
 
23
- # Gets all of the workflow steps that have a status of 'queued' that have a last-updated timestamp older than the number of hours passed in
24
- # This will enable re-queueing of jobs that have been lost by the job manager
25
- # @param [Hash] opts optional values for query
26
- # @option opts [Integer] :hours_ago steps older than this value will be returned by the query. If not passed in, the service defaults to 0 hours,
27
- # meaning you will get all queued workflows
28
- # @option opts [Integer] :limit sets the maximum number of workflow steps that can be returned. Defaults to no limit
29
- # @return [Array[Hash]] each Hash represents a workflow step. It will have the following keys:
30
- # :workflow, :step, :druid, :lane_id
31
- def stale_queued_workflows(opts)
32
- uri_string = build_queued_uri(opts)
33
- parse_queued_workflows_response requestor.request(uri_string)
34
- end
35
-
36
- # Returns a count of workflow steps that have a status of 'queued' that have a last-updated timestamp older than the number of hours passed in
37
- # @param [Hash] opts optional values for query
38
- # @option opts [Integer] :hours_ago steps older than this value will be returned by the query. If not passed in, the service defaults to 0 hours,
39
- # meaning you will get all queued workflows
40
- # @return [Integer] number of stale, queued steps if the :count_only option was set to true
41
- def count_stale_queued_workflows(opts)
42
- uri_string = "#{build_queued_uri(opts)}&count-only=true"
43
- doc = Nokogiri::XML(requestor.request(uri_string))
44
- doc.at_xpath('/objects/@count').value.to_i
45
- end
46
-
47
23
  # Returns a list of druids from the workflow service that meet the criteria
48
24
  # of the passed in completed and waiting params
49
25
  #
@@ -104,65 +80,10 @@ module Dor
104
80
  Nokogiri::XML(resp).xpath('//object[@id]').map { |n| n[:id] }
105
81
  end
106
82
 
107
- # Get a list of druids that have errored out in a particular workflow and step
108
- #
109
- # @param [String] workflow name
110
- # @param [String] step name
111
- #
112
- # @return [Hash] hash of results, with key has a druid, and value as the error message
113
- # @example
114
- # client.errored_objects_for_workstep('accessionWF','content-metadata')
115
- # => {"druid:qd556jq0580"=>"druid:qd556jq0580 - Item error; caused by
116
- # blah blah. See logger for details>"}
117
- def errored_objects_for_workstep(workflow, step)
118
- resp = requestor.request "workflow_queue?workflow=#{workflow}&error=#{step}"
119
- Nokogiri::XML(resp).xpath('//object').to_h do |node|
120
- [node['id'], node['errorMessage']]
121
- end
122
- end
123
-
124
- # Used by preservation robots stats reporter
125
- #
126
- # @param [String] workflow name
127
- # @param [String] step name
128
- # @param [String] type
129
- #
130
- # @return [Hash] hash of results, with key has a druid, and value as the error message
131
- def count_objects_in_step(workflow, step, type)
132
- resp = requestor.request "workflow_queue?workflow=#{workflow}&#{type}=#{step}"
133
- extract_object_count(resp)
134
- end
135
-
136
- # Returns the number of objects that have a status of 'error' in a particular workflow and step
137
- #
138
- # @param [String] workflow name
139
- # @param [String] step name
140
- #
141
- # @return [Integer] Number of objects with this repository:workflow:step that have a status of 'error'
142
- def count_errored_for_workstep(workflow, step)
143
- count_objects_in_step(workflow, step, 'error')
144
- end
145
-
146
- # Returns the number of objects that have a status of 'queued' in a particular workflow and step
147
- #
148
- # @param [String] workflow name
149
- # @param [String] step name
150
- #
151
- # @return [Integer] Number of objects with this repository:workflow:step that have a status of 'queued'
152
- def count_queued_for_workstep(workflow, step)
153
- count_objects_in_step(workflow, step, 'queued')
154
- end
155
-
156
83
  private
157
84
 
158
85
  attr_reader :requestor
159
86
 
160
- def build_queued_uri(opts = {})
161
- query_hash = opts.slice(:hours_ago, :limit).transform_keys { |key| key.to_s.tr('_', '-') }
162
- query_string = URI.encode_www_form(query_hash)
163
- "workflow_queue/all_queued?#{query_string}"
164
- end
165
-
166
87
  # Converts workflow-step into workflow:step
167
88
  # @param [String] default_workflow
168
89
  # @param [String] step if contains colon :, then the value for workflow and/or workflow/repository. For example: 'jp2-create', 'assemblyWF:jp2-create' or 'dor:assemblyWF:jp2-create'
@@ -174,24 +95,6 @@ module Dor
174
95
  current.unshift(default_workflow) if current.length < 2
175
96
  current.join(':')
176
97
  end
177
-
178
- def parse_queued_workflows_response(xml)
179
- Nokogiri::XML(xml).xpath('/workflows/workflow').collect do |wf_node|
180
- {
181
- workflow: wf_node['name'],
182
- step: wf_node['process'],
183
- druid: wf_node['druid'],
184
- lane_id: wf_node['laneId']
185
- }
186
- end
187
- end
188
-
189
- def extract_object_count(resp)
190
- node = Nokogiri::XML(resp).at_xpath('/objects')
191
- raise Dor::WorkflowException, 'Unable to determine count from response' if node.nil?
192
-
193
- node['count'].to_i
194
- end
195
98
  end
196
99
  end
197
100
  end