parallel 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -2
- data.tar.gz.sig +0 -0
- data/lib/parallel.rb +8 -12
- data/lib/parallel/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e98f73ce25c329aab14185e79d68643dde8b705
|
4
|
+
data.tar.gz: bcf7f3490b62a267b9c54b82114c25193fdef811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6209b06e7fd1a09a92c1e485c156b4abc57ba5c230f21ae6d7df5752d06acaf2adc55771230bda207a37a770b0a3241cad33e0d27da125ed1c8642c848f16633
|
7
|
+
data.tar.gz: 6e08572a7a48ce2d5da1e325c02ab701297854fd5e22397835e48d361f86968a79fb764a5c2df91f4cfbf81ff31d9f5bb3ed39ed86f570ffc075c29084fb049f
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
�
|
2
|
-
|
1
|
+
�D���N�3SL���{���,���E�v�ܑ ��4)^��|�zo �k��A�!�u�7�^��ν4��7�R��3�N(��k����mN�`JjN�
|
2
|
+
���G@:�p�L���Z���.�a�����hZ��h]@���h���>�y �ϻ���U�
|
3
|
+
�fhZ����3�F�=4t7
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/parallel.rb
CHANGED
@@ -26,7 +26,7 @@ module Parallel
|
|
26
26
|
|
27
27
|
class Worker
|
28
28
|
attr_reader :pid, :read, :write
|
29
|
-
attr_accessor :
|
29
|
+
attr_accessor :thread
|
30
30
|
def initialize(read, write, pid)
|
31
31
|
@read, @write, @pid = read, write, pid
|
32
32
|
end
|
@@ -52,7 +52,7 @@ module Parallel
|
|
52
52
|
begin
|
53
53
|
Marshal.load(read)
|
54
54
|
rescue EOFError
|
55
|
-
raise DeadWorker
|
55
|
+
raise DeadWorker
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -250,6 +250,7 @@ module Parallel
|
|
250
250
|
kill_on_ctrl_c(workers.map(&:pid)) do
|
251
251
|
in_threads(options[:count]) do |i|
|
252
252
|
worker = workers[i]
|
253
|
+
worker.thread = Thread.current
|
253
254
|
|
254
255
|
begin
|
255
256
|
loop do
|
@@ -264,8 +265,10 @@ module Parallel
|
|
264
265
|
if ExceptionWrapper === output
|
265
266
|
exception = output.exception
|
266
267
|
if Parallel::Kill === exception
|
267
|
-
workers.each
|
268
|
-
|
268
|
+
(workers - [worker]).each do |w|
|
269
|
+
kill_that_thing!(w.thread)
|
270
|
+
kill_that_thing!(w.pid)
|
271
|
+
end
|
269
272
|
end
|
270
273
|
else
|
271
274
|
results[index] = output
|
@@ -364,7 +367,7 @@ module Parallel
|
|
364
367
|
Signal.trap :SIGINT do
|
365
368
|
if @to_be_killed.any?
|
366
369
|
$stderr.puts 'Parallel execution interrupted, exiting ...'
|
367
|
-
|
370
|
+
@to_be_killed.flatten.compact.each { |thing| kill_that_thing!(thing) }
|
368
371
|
end
|
369
372
|
exit 1 # Quit with 'failed' signal
|
370
373
|
end
|
@@ -374,13 +377,6 @@ module Parallel
|
|
374
377
|
@to_be_killed.pop # free threads for GC and do not kill pids that could be used for new processes
|
375
378
|
end
|
376
379
|
|
377
|
-
def kill_everything_we_spawned
|
378
|
-
if defined?(@to_be_killed)
|
379
|
-
@to_be_killed.flatten.compact.each { |thing| kill_that_thing!(thing) }
|
380
|
-
@to_be_killed = [] # in case the ctrl+c kicks in later ...
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
380
|
def kill_that_thing!(thing)
|
385
381
|
if thing.is_a?(Thread)
|
386
382
|
thing.kill
|
data/lib/parallel/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
F5etKHZg0j3eHO31/i2HnswY04lqGImUu6aM5EnijFTB7PPW2KwKKM4+kKDYFdlw
|
31
31
|
/0WV1Ng2/Y6qsHwmqGg2VlYj2h4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2014-07-
|
33
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description:
|
36
36
|
email: michael@grosser.it
|
metadata.gz.sig
CHANGED
Binary file
|