Skip to content

Commit b985b62

Browse files
committed
Make raise_exception default to false for parallel run tasks
1 parent 1c2a4c1 commit b985b62

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

lib/octocatalog-diff/util/catalogs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def build_catalog_parallelizer
8989

9090
# Execute the parallelized catalog builds
9191
passed_catalog_tasks = catalog_tasks.map { |x| x[1] }
92-
parallel_catalogs = OctocatalogDiff::Util::Parallel.run_tasks(passed_catalog_tasks, @logger, @options[:parallel], false)
92+
parallel_catalogs = OctocatalogDiff::Util::Parallel.run_tasks(passed_catalog_tasks, @logger, @options[:parallel])
9393

9494
# If the catalogs array is empty at this point, there is an unexpected size mismatch. This should
9595
# never happen, but test for it anyway.

lib/octocatalog-diff/util/parallel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def initialize(opts = {})
6262
#
6363
# Note: Parallelization throws intermittent errors under travis CI, so it will be disabled by
6464
# default for integration tests.
65-
def self.run_tasks(task_array, logger = nil, parallelized = true, raise_exception = true)
65+
def self.run_tasks(task_array, logger = nil, parallelized = true, raise_exception = false)
6666
# Create a throwaway logger object if one is not given
6767
logger ||= Logger.new(StringIO.new)
6868

spec/octocatalog-diff/tests/util/parallel_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def two(_arg, _logger = nil)
6969
c = Foo.new
7070
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1')
7171
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2')
72-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true, false)
72+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true)
7373
expect(result).to be_a_kind_of(Array)
7474
expect(result.size).to eq(2)
7575

@@ -102,7 +102,7 @@ def two(_arg, _logger = nil)
102102
c = Foo.new
103103
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1')
104104
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2')
105-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true, false)
105+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true)
106106
expect(result).to be_a_kind_of(Array)
107107
expect(result.size).to eq(2)
108108

@@ -133,12 +133,12 @@ def my_method(arg, _logger = nil)
133133
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:my_method), args: 'abc', description: 'test1')
134134
expect do
135135
logger = Logger.new(STDERR)
136-
OctocatalogDiff::Util::Parallel.run_tasks([one], logger, true, false)
136+
OctocatalogDiff::Util::Parallel.run_tasks([one], logger, true)
137137
end.to output(/DEBUG.*Begin test1/).to_stderr_from_any_process
138138

139139
expect do
140140
logger = Logger.new(STDERR)
141-
OctocatalogDiff::Util::Parallel.run_tasks([one], logger, true, false)
141+
OctocatalogDiff::Util::Parallel.run_tasks([one], logger, true)
142142
end.to output(/DEBUG.*Success test1/).to_stderr_from_any_process
143143
end
144144

@@ -154,12 +154,12 @@ def my_method(arg, _logger = nil)
154154
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:my_method), args: 'def', description: 'test2')
155155
expect do
156156
logger = Logger.new(STDERR)
157-
OctocatalogDiff::Util::Parallel.run_tasks([one, two], logger, true, false)
157+
OctocatalogDiff::Util::Parallel.run_tasks([one, two], logger, true)
158158
end.to output(/DEBUG.*Begin test[12]/).to_stderr_from_any_process
159159

160160
expect do
161161
logger = Logger.new(STDERR)
162-
OctocatalogDiff::Util::Parallel.run_tasks([one, two], logger, true, false)
162+
OctocatalogDiff::Util::Parallel.run_tasks([one, two], logger, true)
163163
end.to output(/DEBUG.*Failed test[12]: RuntimeError (abc|def)/).to_stderr_from_any_process
164164
end
165165

@@ -215,7 +215,7 @@ def validate(arg, _logger = nil, _extra_args = {})
215215
v = c.method(:validate)
216216
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1', validator: v)
217217
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2', validator: v)
218-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true, false)
218+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true)
219219
expect(result).to be_a_kind_of(Array)
220220
expect(result.size).to eq(2)
221221

@@ -243,7 +243,7 @@ def validate(arg, _logger = nil, _extra_args = {})
243243
v = c.method(:validate)
244244
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1', validator: v)
245245
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2', validator: v)
246-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true, false)
246+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, true)
247247
expect(result).to be_a_kind_of(Array)
248248
expect(result.size).to eq(2)
249249

@@ -303,7 +303,7 @@ def two(_arg, _logger = nil)
303303
c = Foo.new
304304
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1')
305305
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2')
306-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false, false)
306+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false)
307307
expect(result).to be_a_kind_of(Array)
308308
expect(result.size).to eq(2)
309309

@@ -334,7 +334,7 @@ def two(arg, _logger = nil)
334334
c = Foo.new
335335
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1')
336336
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2')
337-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false, false)
337+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false)
338338
expect(result).to be_a_kind_of(Array)
339339
expect(result.size).to eq(2)
340340

@@ -378,7 +378,7 @@ def my_method(arg, _logger = nil)
378378
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:my_method), args: 'abc', description: 'test1')
379379
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:my_method), args: 'def', description: 'test2')
380380
logger, logger_string = OctocatalogDiff::Spec.setup_logger
381-
OctocatalogDiff::Util::Parallel.run_tasks([one, two], logger, false, false)
381+
OctocatalogDiff::Util::Parallel.run_tasks([one, two], logger, false)
382382
expect(logger_string.string).to match(/DEBUG.*Begin test1/)
383383
expect(logger_string.string).to match(/DEBUG.*Failed test1: RuntimeError abc/)
384384
end
@@ -407,7 +407,7 @@ def validate(arg, _logger = nil, _extra_args = {})
407407
v = c.method(:validate)
408408
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1', validator: v)
409409
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2', validator: v)
410-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false)
410+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil)
411411
expect(result).to be_a_kind_of(Array)
412412
expect(result.size).to eq(2)
413413

@@ -434,7 +434,7 @@ def validate(arg, _logger = nil, _extra_args = {})
434434
v = c.method(:validate)
435435
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1', validator: v)
436436
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2', validator: v)
437-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false, false)
437+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false)
438438
expect(result).to be_a_kind_of(Array)
439439
expect(result.size).to eq(2)
440440

@@ -461,7 +461,7 @@ def validate(arg, _logger = nil, _extra_args = {})
461461
v = c.method(:validate)
462462
one = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:one), args: 'abc', description: 'test1', validator: v)
463463
two = OctocatalogDiff::Util::Parallel::Task.new(method: c.method(:two), args: 'def', description: 'test2', validator: v)
464-
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false, false)
464+
result = OctocatalogDiff::Util::Parallel.run_tasks([one, two], nil, false)
465465
expect(result).to be_a_kind_of(Array)
466466
expect(result.size).to eq(2)
467467

0 commit comments

Comments
 (0)