parallel_workforce 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2faae1c8d652df656ef1a625fb048207f340ef86
4
+ data.tar.gz: 197ca9d26aca9c1db4ced4d7266974a870978a9f
5
+ SHA512:
6
+ metadata.gz: 86399e51585659405aae9774eac587c493f1f4acd5779077235f89c9eaf41f71a3cd1f7894d3addb97a8afb9f9b9ccc9aeafda0f15f73d6f2e345fda26042ad6
7
+ data.tar.gz: 10e835470259ae517cf383e19b517e318249ec542bdf1e7e701e197f8706b329069f243877542e7e39cf54559bc2f31ecb38bfa8bd0464f5400f20c21cb6ee83
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ **/tags
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - .rubocop_parallel_workforce.yml
@@ -0,0 +1,365 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - 'bin/bundle'
7
+ - 'Gemfile'
8
+ - 'tmp/**/*'
9
+ TargetRubyVersion: 2.3
10
+ UseCache: true
11
+ CacheRootDirectory: 'tmp'
12
+
13
+ # default 15
14
+ Metrics/AbcSize:
15
+ Max: 20
16
+
17
+ Lint/UnusedBlockArgument:
18
+ Enabled: false
19
+
20
+ Lint/UnusedMethodArgument:
21
+ Enabled: false
22
+
23
+ Lint/ShadowingOuterLocalVariable:
24
+ Enabled: false
25
+
26
+ Lint/RescueException:
27
+ Enabled: false
28
+
29
+ Metrics/LineLength:
30
+ Max: 128
31
+
32
+ # clarity over performance for now
33
+ Performance/RedundantBlockCall:
34
+ Enabled: false
35
+
36
+ RSpec/DescribeClass:
37
+ Enabled: false
38
+
39
+ RSpec/DescribedClass:
40
+ Enabled: false
41
+
42
+ # RSpec/VerifiedDoubles:
43
+ # Enabled: true
44
+
45
+ Layout/AlignHash:
46
+ Enabled: false
47
+
48
+ Layout/AlignParameters:
49
+ Enabled: false
50
+
51
+ Layout/RescueEnsureAlignment:
52
+ Enabled: false
53
+
54
+ Style/BarePercentLiterals:
55
+ EnforcedStyle: percent_q
56
+
57
+ # would require do/end for multiline blocks
58
+ Style/BlockDelimiters:
59
+ Enabled: false
60
+
61
+ Layout/CaseIndentation:
62
+ EnforcedStyle: case
63
+
64
+ # disabled because it mostly mashed attr_reader methods up against the first method of a class
65
+ Layout/EmptyLinesAroundArguments:
66
+ Enabled: false
67
+
68
+ # explicit decision from team months ago to allow either indentation style
69
+ Layout/MultilineMethodCallIndentation:
70
+ Enabled: false
71
+
72
+ # good standard, but cop also prevents common 2 line ternary statements
73
+ Style/MultilineTernaryOperator:
74
+ Enabled: false
75
+
76
+ Style/NegatedIf:
77
+ Enabled: false
78
+
79
+ Layout/SpaceInLambdaLiteral:
80
+ Enabled: true
81
+ EnforcedStyle: require_space
82
+
83
+ Layout/TrailingBlankLines:
84
+ EnforcedStyle: final_newline
85
+
86
+ Style/CollectionMethods:
87
+ PreferredMethods:
88
+ collect: 'map'
89
+ collect!: 'map!'
90
+ reduce: 'inject'
91
+ find: 'detect'
92
+
93
+ Style/SingleLineMethods:
94
+ Enabled: false
95
+
96
+ Metrics/ClassLength:
97
+ Max: 100
98
+
99
+ # default 10
100
+ Metrics/MethodLength:
101
+ Max: 17
102
+
103
+ Metrics/ModuleLength:
104
+ Exclude:
105
+ - 'spec/**/*'
106
+
107
+ Security/MarshalLoad:
108
+ Enabled: false
109
+
110
+ RSpec/FilePath:
111
+ Enabled: false
112
+
113
+ Style/Documentation:
114
+ Enabled: false
115
+
116
+ Layout/DotPosition:
117
+ EnforcedStyle: leading
118
+
119
+ Style/DoubleNegation:
120
+ Enabled: false
121
+
122
+ Layout/EmptyLines:
123
+ Enabled: false
124
+
125
+ Layout/EmptyLinesAroundClassBody:
126
+ Enabled: false
127
+
128
+ Layout/EmptyLinesAroundModuleBody:
129
+ Enabled: false
130
+
131
+ Style/GuardClause:
132
+ Enabled: false
133
+
134
+ # disabled per group consensus
135
+ Style/IfUnlessModifier:
136
+ Enabled: false
137
+
138
+ Layout/IndentArray:
139
+ EnforcedStyle: consistent
140
+
141
+ Layout/MultilineOperationIndentation:
142
+ Enabled: true
143
+ EnforcedStyle: indented
144
+
145
+ Style/NumericLiterals:
146
+ Enabled: false
147
+
148
+ # Consider enabling - kwargs are often the better option
149
+ Style/OptionHash:
150
+ Enabled: false
151
+
152
+ Style/PercentLiteralDelimiters:
153
+ Enabled: false
154
+
155
+ Style/Alias:
156
+ EnforcedStyle: prefer_alias_method
157
+
158
+ Style/RaiseArgs:
159
+ EnforcedStyle: compact
160
+
161
+ Style/RegexpLiteral:
162
+ Enabled: false
163
+
164
+ Style/SingleLineBlockParams:
165
+ Enabled: false
166
+
167
+ Style/StringLiterals:
168
+ Enabled: false
169
+
170
+ Layout/SpaceAroundEqualsInParameterDefault:
171
+ EnforcedStyle: no_space
172
+
173
+ Style/TrailingCommaInArguments:
174
+ EnforcedStyleForMultiline: comma
175
+
176
+ Style/TrailingCommaInArrayLiteral:
177
+ EnforcedStyleForMultiline: comma
178
+
179
+ Style/TrailingCommaInHashLiteral:
180
+ EnforcedStyleForMultiline: comma
181
+
182
+ Style/TrivialAccessors:
183
+ Enabled: false
184
+
185
+ # both cases where we used %Q were cleaner to read
186
+ Style/UnneededPercentQ:
187
+ Enabled: false
188
+
189
+ Style/WordArray:
190
+ Enabled: false
191
+
192
+ Style/FormatString:
193
+ Enabled: false
194
+
195
+ Style/ClassAndModuleChildren:
196
+ Exclude:
197
+ - 'spec/**/*'
198
+
199
+ # The following cops are added between 0.37.0 and 0.59.2.
200
+ # The configurations are default.
201
+ # If you want to use a cop by default, remove a configuration for the cop from here.
202
+ # If you want to disable a cop, change `Enabled` to false.
203
+
204
+ # still evaluating
205
+ Lint/NumberConversion:
206
+ Description: Checks unsafe usage of number conversion methods.
207
+ Enabled: true
208
+
209
+ # still evaluating
210
+ Metrics/BlockLength:
211
+ Description: Avoid long blocks with many lines.
212
+ Enabled: true
213
+ CountComments: false
214
+ Max: 25
215
+ ExcludedMethods:
216
+ - refine
217
+ Exclude:
218
+ - spec/**/*
219
+
220
+ # turning off intentionally
221
+ Naming/HeredocDelimiterNaming:
222
+ Description: Use descriptive heredoc delimiters.
223
+ StyleGuide: '#heredoc-delimiters'
224
+ Enabled: false
225
+ Blacklist:
226
+ - !ruby/regexp /(^|\s)(EO[A-Z]{1}|END)(\s|$)/
227
+
228
+ # to evaluate - theorized churn with low value
229
+ Naming/MemoizedInstanceVariableName:
230
+ Description: Memoized method name should match memo instance variable name.
231
+ Enabled: true
232
+ EnforcedStyleForLeadingUnderscores: disallowed
233
+ SupportedStylesForLeadingUnderscores:
234
+ - disallowed
235
+ - required
236
+ - optional
237
+
238
+ # Drop this if we hit a bunch of violations
239
+ Naming/UncommunicativeBlockParamName:
240
+ Description:
241
+ Checks for block parameter names that contain capital letters, end in
242
+ numbers, or do not meet a minimal length.
243
+ Enabled: true
244
+ MinNameLength: 1
245
+ AllowNamesEndingInNumbers: true
246
+ AllowedNames: []
247
+ ForbiddenNames: []
248
+
249
+ # intentionally disabled
250
+ Naming/VariableNumber:
251
+ Description: Use the configured style when numbering variables.
252
+ Enabled: false
253
+ EnforcedStyle: normalcase
254
+ SupportedStyles:
255
+ - snake_case
256
+ - normalcase
257
+ - non_integer
258
+
259
+ # intentionally disabled
260
+ Performance/UnfreezeString:
261
+ Description: Use unary plus to get an unfrozen string literal.
262
+ Enabled: false
263
+
264
+ # Supports --auto-correct
265
+ # Style customized to expanded
266
+ Style/EmptyMethod:
267
+ Description: Checks the formatting of empty method definitions.
268
+ StyleGuide: '#no-single-line-methods'
269
+ Enabled: true
270
+ EnforcedStyle: expanded
271
+ SupportedStyles:
272
+ - compact
273
+ - expanded
274
+
275
+ # revisit in future if upgrading to Ruby 3.0+
276
+ # Cop supports --auto-correct.
277
+ # Configuration parameters: EnforcedStyle.
278
+ # SupportedStyles: when_needed, always, never
279
+ Style/FrozenStringLiteralComment:
280
+ Enabled: false
281
+
282
+ # Consider enabling (will cause a lot of churn)
283
+ Style/ImplicitRuntimeError:
284
+ Description:
285
+ Use `raise` or `fail` with an explicit exception class and message, rather
286
+ than just a message.
287
+ Enabled: false
288
+
289
+ # Supports --auto-correct
290
+ # Intentionally disabled (we don't care how you do this)
291
+ Style/NumericPredicate:
292
+ Description: Checks for the use of predicate- or comparison methods for numeric comparisons.
293
+ StyleGuide: '#predicate-methods'
294
+ AutoCorrect: false
295
+ Enabled: false
296
+ EnforcedStyle: predicate
297
+ SupportedStyles:
298
+ - predicate
299
+ - comparison
300
+ IgnoredMethods: []
301
+
302
+ # Supports --auto-correct
303
+ # Set to implicit style
304
+ Style/RescueStandardError:
305
+ Description: Avoid rescuing without specifying an error class.
306
+ Enabled: true
307
+ EnforcedStyle: implicit
308
+ SupportedStyles:
309
+ - implicit
310
+ - explicit
311
+
312
+ # Supports --auto-correct
313
+ # Enabled, set to return nil implicitly
314
+ Style/ReturnNil:
315
+ Description: Use return instead of return nil.
316
+ Enabled: true
317
+ EnforcedStyle: return
318
+ SupportedStyles:
319
+ - return
320
+ - return_nil
321
+
322
+ # Supports --auto-correct
323
+ # Set to require_parentheses_when_complex
324
+ Style/TernaryParentheses:
325
+ Description: Checks for use of parentheses around ternary conditions.
326
+ Enabled: true
327
+ EnforcedStyle: require_parentheses_when_complex
328
+ SupportedStyles:
329
+ - require_parentheses
330
+ - require_no_parentheses
331
+ - require_parentheses_when_complex
332
+ AllowSafeAssignment: true
333
+
334
+ # Cop supports --auto-correct.
335
+ # Configuration parameters: EnforcedStyle, MinSize.
336
+ # SupportedStyles: percent, brackets
337
+ Style/SymbolArray:
338
+ Enabled: true
339
+ MinSize: 8
340
+
341
+ # Cop supports --auto-correct.
342
+ RSpec/LeadingSubject:
343
+ Enabled: false
344
+
345
+ RSpec/LetSetup:
346
+ Enabled: false
347
+
348
+ # Configuration parameters: AggregateFailuresByDefault.
349
+ RSpec/MultipleExpectations:
350
+ Enabled: false
351
+
352
+ RSpec/NamedSubject:
353
+ Enabled: false
354
+
355
+ RSpec/InstanceVariable:
356
+ Enabled: false
357
+
358
+ RSpec/ExampleLength:
359
+ Enabled: false
360
+
361
+ RSpec/ExpectInHook:
362
+ Enabled: false
363
+
364
+ RSpec/MessageSpies:
365
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.3.5
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ ## 0.2.0
2
+
3
+ * Add optional execution block to `ParallelWorkforce.perform_all` that is evaluated in calling thread after jobs enqueued,
4
+ but before blocking for job responses.
5
+ * Add `production_environment` configuration that disables unnecessary serialization/deserialization when executing in
6
+ serial mode. Uses Rails.env if available, otherwise defaults to true.
7
+
8
+ ## 0.1.0
9
+
10
+ * Initial release.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in parallel_workforce.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,169 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ parallel_workforce (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.2.11)
10
+ actionpack (= 4.2.11)
11
+ actionview (= 4.2.11)
12
+ activejob (= 4.2.11)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.11)
16
+ actionview (= 4.2.11)
17
+ activesupport (= 4.2.11)
18
+ rack (~> 1.6)
19
+ rack-test (~> 0.6.2)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (4.2.11)
23
+ activesupport (= 4.2.11)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
28
+ activejob (4.2.11)
29
+ activesupport (= 4.2.11)
30
+ globalid (>= 0.3.0)
31
+ activemodel (4.2.11)
32
+ activesupport (= 4.2.11)
33
+ builder (~> 3.1)
34
+ activerecord (4.2.11)
35
+ activemodel (= 4.2.11)
36
+ activesupport (= 4.2.11)
37
+ arel (~> 6.0)
38
+ activesupport (4.2.11)
39
+ i18n (~> 0.7)
40
+ minitest (~> 5.1)
41
+ thread_safe (~> 0.3, >= 0.3.4)
42
+ tzinfo (~> 1.1)
43
+ arel (6.0.4)
44
+ ast (2.4.0)
45
+ builder (3.2.3)
46
+ coderay (1.1.2)
47
+ concurrent-ruby (1.1.4)
48
+ connection_pool (2.2.2)
49
+ crass (1.0.4)
50
+ diff-lcs (1.3)
51
+ erubis (2.7.0)
52
+ fakeredis (0.7.0)
53
+ redis (>= 3.2, < 5.0)
54
+ globalid (0.4.2)
55
+ activesupport (>= 4.2.0)
56
+ i18n (0.9.5)
57
+ concurrent-ruby (~> 1.0)
58
+ jaro_winkler (1.5.2)
59
+ loofah (2.2.3)
60
+ crass (~> 1.0.2)
61
+ nokogiri (>= 1.5.9)
62
+ mail (2.7.1)
63
+ mini_mime (>= 0.1.1)
64
+ method_source (0.9.2)
65
+ mini_mime (1.0.1)
66
+ mini_portile2 (2.4.0)
67
+ minitest (5.11.3)
68
+ nokogiri (1.10.1)
69
+ mini_portile2 (~> 2.4.0)
70
+ parallel (1.14.0)
71
+ parser (2.6.0.0)
72
+ ast (~> 2.4.0)
73
+ powerpack (0.1.2)
74
+ pry (0.12.2)
75
+ coderay (~> 1.1.0)
76
+ method_source (~> 0.9.0)
77
+ psych (3.1.0)
78
+ rack (1.6.11)
79
+ rack-protection (2.0.5)
80
+ rack
81
+ rack-test (0.6.3)
82
+ rack (>= 1.0)
83
+ rails (4.2.11)
84
+ actionmailer (= 4.2.11)
85
+ actionpack (= 4.2.11)
86
+ actionview (= 4.2.11)
87
+ activejob (= 4.2.11)
88
+ activemodel (= 4.2.11)
89
+ activerecord (= 4.2.11)
90
+ activesupport (= 4.2.11)
91
+ bundler (>= 1.3.0, < 2.0)
92
+ railties (= 4.2.11)
93
+ sprockets-rails
94
+ rails-deprecated_sanitizer (1.0.3)
95
+ activesupport (>= 4.2.0.alpha)
96
+ rails-dom-testing (1.0.9)
97
+ activesupport (>= 4.2.0, < 5.0)
98
+ nokogiri (~> 1.6)
99
+ rails-deprecated_sanitizer (>= 1.0.1)
100
+ rails-html-sanitizer (1.0.4)
101
+ loofah (~> 2.2, >= 2.2.2)
102
+ railties (4.2.11)
103
+ actionpack (= 4.2.11)
104
+ activesupport (= 4.2.11)
105
+ rake (>= 0.8.7)
106
+ thor (>= 0.18.1, < 2.0)
107
+ rainbow (3.0.0)
108
+ rake (10.4.2)
109
+ redis (3.3.5)
110
+ rspec (3.8.0)
111
+ rspec-core (~> 3.8.0)
112
+ rspec-expectations (~> 3.8.0)
113
+ rspec-mocks (~> 3.8.0)
114
+ rspec-core (3.8.0)
115
+ rspec-support (~> 3.8.0)
116
+ rspec-expectations (3.8.2)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.8.0)
119
+ rspec-mocks (3.8.0)
120
+ diff-lcs (>= 1.2.0, < 2.0)
121
+ rspec-support (~> 3.8.0)
122
+ rspec-support (3.8.0)
123
+ rubocop (0.65.0)
124
+ jaro_winkler (~> 1.5.1)
125
+ parallel (~> 1.10)
126
+ parser (>= 2.5, != 2.5.1.1)
127
+ powerpack (~> 0.1)
128
+ psych (>= 3.1.0)
129
+ rainbow (>= 2.2.2, < 4.0)
130
+ ruby-progressbar (~> 1.7)
131
+ unicode-display_width (~> 1.4.0)
132
+ rubocop-rspec (1.32.0)
133
+ rubocop (>= 0.60.0)
134
+ ruby-progressbar (1.10.0)
135
+ sidekiq (4.2.10)
136
+ concurrent-ruby (~> 1.0)
137
+ connection_pool (~> 2.2, >= 2.2.0)
138
+ rack-protection (>= 1.5.0)
139
+ redis (~> 3.2, >= 3.2.1)
140
+ sprockets (3.7.2)
141
+ concurrent-ruby (~> 1.0)
142
+ rack (> 1, < 3)
143
+ sprockets-rails (3.2.1)
144
+ actionpack (>= 4.0)
145
+ activesupport (>= 4.0)
146
+ sprockets (>= 3.0.0)
147
+ thor (0.20.3)
148
+ thread_safe (0.3.6)
149
+ tzinfo (1.2.5)
150
+ thread_safe (~> 0.1)
151
+ unicode-display_width (1.4.1)
152
+
153
+ PLATFORMS
154
+ ruby
155
+
156
+ DEPENDENCIES
157
+ bundler (~> 1.17)
158
+ fakeredis (~> 0.7)
159
+ parallel_workforce!
160
+ pry (~> 0.12)
161
+ rails (~> 4.2)
162
+ rake (~> 10.0)
163
+ rspec (~> 3.8)
164
+ rubocop (~> 0.65)
165
+ rubocop-rspec (~> 1.32)
166
+ sidekiq (~> 4.0)
167
+
168
+ BUNDLED WITH
169
+ 1.17.3