parallel 1.16.2 → 1.19.2
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 +4 -4
- data/lib/parallel.rb +17 -6
- data/lib/parallel/processor_count.rb +3 -5
- data/lib/parallel/version.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5633042712162c3ac1b37b31f546cf70eb45513bc78c2180a5009c8d5a1826a
|
4
|
+
data.tar.gz: 621b9b2dfa7d8d67494da0ff0ad82c14d67d7e8b11fd73e14fe3b38e7aeaccab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7de2bb3f72d999e4eacfe84ff8df6ece7d62e60e044ba512fe11d38f2597a53f5c4ccbd0399a9e531184b8e17b25b7671be61d6ef63d739767fcf77bd9808933
|
7
|
+
data.tar.gz: 76adaacedc029a347231d1690913a2eaccce021e99e80e94a59685a418e617144ad65077d77cc87fd01a3a9cf7a6a4a6250fc2792a3b54f303ef4d99929c4e98
|
data/lib/parallel.rb
CHANGED
@@ -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
|
-
|
206
|
-
|
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
|
-
|
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
|
6
|
+
# Number of processors seen by the OS, used for process scheduling
|
6
7
|
def processor_count
|
7
|
-
@processor_count ||=
|
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"]
|
data/lib/parallel/version.rb
CHANGED
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.
|
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:
|
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
|
-
|
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
|