parallel 0.5.18 → 0.5.19
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +11 -11
- data/lib/parallel.rb +8 -1
- data/lib/parallel/version.rb +1 -1
- data/spec/parallel_spec.rb +8 -8
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
parallel (0.5.
|
4
|
+
parallel (0.5.19)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
diff-lcs (1.1.
|
10
|
-
rake (0.
|
11
|
-
rspec (2.
|
12
|
-
rspec-core (~> 2.
|
13
|
-
rspec-expectations (~> 2.
|
14
|
-
rspec-mocks (~> 2.
|
15
|
-
rspec-core (2.
|
16
|
-
rspec-expectations (2.
|
17
|
-
diff-lcs (~> 1.1.
|
18
|
-
rspec-mocks (2.
|
9
|
+
diff-lcs (1.1.3)
|
10
|
+
rake (0.9.2.2)
|
11
|
+
rspec (2.11.0)
|
12
|
+
rspec-core (~> 2.11.0)
|
13
|
+
rspec-expectations (~> 2.11.0)
|
14
|
+
rspec-mocks (~> 2.11.0)
|
15
|
+
rspec-core (2.11.1)
|
16
|
+
rspec-expectations (2.11.3)
|
17
|
+
diff-lcs (~> 1.1.3)
|
18
|
+
rspec-mocks (2.11.3)
|
19
19
|
|
20
20
|
PLATFORMS
|
21
21
|
ruby
|
data/lib/parallel.rb
CHANGED
@@ -264,7 +264,14 @@ module Parallel
|
|
264
264
|
def self.kill_on_ctrl_c(pids)
|
265
265
|
Signal.trap :SIGINT do
|
266
266
|
$stderr.puts 'Parallel execution interrupted, exiting ...'
|
267
|
-
pids.each
|
267
|
+
pids.compact.each do |pid|
|
268
|
+
begin
|
269
|
+
Process.kill(:KILL, pid)
|
270
|
+
rescue Errno::ESRCH
|
271
|
+
# some linux systems already automatically killed the children at this point
|
272
|
+
# so we just ignore them not being there
|
273
|
+
end
|
274
|
+
end
|
268
275
|
exit 1 # Quit with 'failed' signal
|
269
276
|
end
|
270
277
|
end
|
data/lib/parallel/version.rb
CHANGED
data/spec/parallel_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe Parallel do
|
|
7
7
|
Time.now.to_f - t
|
8
8
|
end
|
9
9
|
|
10
|
-
describe
|
10
|
+
describe ".processor_count" do
|
11
11
|
it "returns a number" do
|
12
12
|
(1..999).should include(Parallel.processor_count)
|
13
13
|
end
|
@@ -24,7 +24,7 @@ describe Parallel do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
27
|
+
describe ".physical_processor_count" do
|
28
28
|
it "returns a number" do
|
29
29
|
(1..999).should include(Parallel.physical_processor_count)
|
30
30
|
end
|
@@ -34,7 +34,7 @@ describe Parallel do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
describe
|
37
|
+
describe ".in_processes" do
|
38
38
|
def cpus
|
39
39
|
Parallel.processor_count
|
40
40
|
end
|
@@ -100,7 +100,7 @@ describe Parallel do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
describe
|
103
|
+
describe ".in_threads" do
|
104
104
|
it "saves time" do
|
105
105
|
time_taken{
|
106
106
|
Parallel.in_threads(3){ sleep 2 }
|
@@ -120,7 +120,7 @@ describe Parallel do
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
describe
|
123
|
+
describe ".map" do
|
124
124
|
it "saves time" do
|
125
125
|
time_taken{
|
126
126
|
`ruby spec/cases/parallel_map_sleeping.rb`
|
@@ -176,7 +176,7 @@ describe Parallel do
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
describe
|
179
|
+
describe ".map_with_index" do
|
180
180
|
it "yields object and index" do
|
181
181
|
`ruby spec/cases/map_with_index.rb 2>&1`.should == 'a0b1'
|
182
182
|
end
|
@@ -196,7 +196,7 @@ describe Parallel do
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
describe
|
199
|
+
describe ".each" do
|
200
200
|
it "returns original array, works like map" do
|
201
201
|
`ruby spec/cases/each.rb`.should == 'a b c d'
|
202
202
|
end
|
@@ -206,7 +206,7 @@ describe Parallel do
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
-
describe
|
209
|
+
describe ".each_with_index" do
|
210
210
|
it "yields object and index" do
|
211
211
|
`ruby spec/cases/each_with_index.rb 2>&1`.should == 'a0b1'
|
212
212
|
end
|
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: 0.5.
|
4
|
+
version: 0.5.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: michael@grosser.it
|
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
segments:
|
68
68
|
- 0
|
69
|
-
hash: -
|
69
|
+
hash: -960413124203525462
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
71
|
none: false
|
72
72
|
requirements:
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
segments:
|
77
77
|
- 0
|
78
|
-
hash: -
|
78
|
+
hash: -960413124203525462
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
81
|
rubygems_version: 1.8.24
|