parallel 1.16.2 → 1.19.2

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: 8b37ab79cd4bc5553a9663242658e3ebe5176b012ab8249507769cdd033a1647
4
- data.tar.gz: e2cd38e24a3599200c0ed28e18ad1a7892d6f9f44b1d4745e0f94f65efd16339
3
+ metadata.gz: f5633042712162c3ac1b37b31f546cf70eb45513bc78c2180a5009c8d5a1826a
4
+ data.tar.gz: 621b9b2dfa7d8d67494da0ff0ad82c14d67d7e8b11fd73e14fe3b38e7aeaccab
5
5
  SHA512:
6
- metadata.gz: dbe5f61e9cb9c58d6a4e3c415d52943fbcff5ecc184a56ed1b0732806b6aea79276dacbf602c5bdadcdfafcdbab64e2c12cc9b8d04a7c6c7c889b9f501b519df
7
- data.tar.gz: e6349716635198a4c33830d1f4812bb84a7d32116ecfde98471808fe475ecae8231485d26e56282cae6b58b85fb0d604ef88eea04ef84b58be8dbbe8b416a564
6
+ metadata.gz: 7de2bb3f72d999e4eacfe84ff8df6ece7d62e60e044ba512fe11d38f2597a53f5c4ccbd0399a9e531184b8e17b25b7671be61d6ef63d739767fcf77bd9808933
7
+ data.tar.gz: 76adaacedc029a347231d1690913a2eaccce021e99e80e94a59685a418e617144ad65077d77cc87fd01a3a9cf7a6a4a6250fc2792a3b54f303ef4d99929c4e98
@@ -201,13 +201,21 @@ module Parallel
201
201
 
202
202
  class << self
203
203
  def in_threads(options={:count => 2})
204
+ threads = []
204
205
  count, _ = extract_count_from_options(options)
205
- threads = Array.new(count) do |i|
206
- Thread.new { yield(i) }
206
+
207
+ Thread.handle_interrupt(Exception => :never) do
208
+ begin
209
+ Thread.handle_interrupt(Exception => :immediate) do
210
+ count.times do |i|
211
+ threads << Thread.new { yield(i) }
212
+ end
213
+ threads.map(&:value)
214
+ end
215
+ ensure
216
+ threads.each(&:kill)
217
+ end
207
218
  end
208
- threads.map(&:value)
209
- ensure
210
- threads.each(&:kill)
211
219
  end
212
220
 
213
221
  def in_processes(options = {}, &block)
@@ -462,7 +470,10 @@ module Parallel
462
470
  item, index = job_factory.unpack(data)
463
471
  result = begin
464
472
  call_with_index(item, index, options, &block)
465
- rescue
473
+ # https://github.com/rspec/rspec-support/blob/673133cdd13b17077b3d88ece8d7380821f8d7dc/lib/rspec/support.rb#L132-L140
474
+ rescue NoMemoryError, SignalException, Interrupt, SystemExit
475
+ raise $!
476
+ rescue Exception
466
477
  ExceptionWrapper.new($!)
467
478
  end
468
479
  begin
@@ -1,16 +1,14 @@
1
1
  require 'etc'
2
2
 
3
3
  module Parallel
4
+ # TODO: inline this method into parallel.rb and kill physical_processor_count in next major release
4
5
  module ProcessorCount
5
- # Number of processors seen by the OS and used for process scheduling. It's just wrapper for Etc.nprocessors
6
+ # Number of processors seen by the OS, used for process scheduling
6
7
  def processor_count
7
- @processor_count ||= begin
8
- Etc.nprocessors
9
- end
8
+ @processor_count ||= Integer(ENV['PARALLEL_PROCESSOR_COUNT'] || Etc.nprocessors)
10
9
  end
11
10
 
12
11
  # Number of physical processor cores on the current system.
13
- #
14
12
  def physical_processor_count
15
13
  @physical_processor_count ||= begin
16
14
  ppc = case RbConfig::CONFIG["target_os"]
@@ -1,3 +1,3 @@
1
1
  module Parallel
2
- VERSION = Version = '1.16.2'
2
+ VERSION = Version = '1.19.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.2
4
+ version: 1.19.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-29 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it
@@ -23,7 +23,11 @@ files:
23
23
  homepage: https://github.com/grosser/parallel
24
24
  licenses:
25
25
  - MIT
26
- metadata: {}
26
+ metadata:
27
+ bug_tracker_uri: https://github.com/grosser/parallel/issues
28
+ documentation_uri: https://github.com/grosser/parallel/blob/v1.19.2/Readme.md
29
+ source_code_uri: https://github.com/grosser/parallel/tree/v1.19.2
30
+ wiki_uri: https://github.com/grosser/parallel/wiki
27
31
  post_install_message:
28
32
  rdoc_options: []
29
33
  require_paths:
@@ -39,8 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
43
  - !ruby/object:Gem::Version
40
44
  version: '0'
41
45
  requirements: []
42
- rubyforge_project:
43
- rubygems_version: 2.7.6
46
+ rubygems_version: 3.1.3
44
47
  signing_key:
45
48
  specification_version: 4
46
49
  summary: Run any kind of code in parallel processes