parallel 0.4.3 → 0.4.4
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.
- data/Rakefile +3 -3
- data/Readme.md +2 -1
- data/VERSION +1 -1
- data/lib/parallel.rb +2 -0
- data/parallel.gemspec +2 -2
- data/spec/cases/cloeses_processes_at_runtime.rb +1 -1
- data/spec/cases/each.rb +1 -1
- data/spec/cases/each_with_index.rb +1 -1
- data/spec/cases/map_with_index.rb +1 -1
- data/spec/cases/map_with_index_empty.rb +1 -1
- data/spec/cases/no_dump_with_each.rb +1 -1
- data/spec/cases/parallel_high_fork_rate.rb +2 -1
- data/spec/cases/parallel_influence_outside_data.rb +1 -1
- data/spec/cases/parallel_map.rb +1 -1
- data/spec/cases/parallel_map_range.rb +2 -2
- data/spec/cases/parallel_map_sleeping.rb +1 -1
- data/spec/cases/parallel_map_uneven.rb +1 -1
- data/spec/cases/parallel_raise.rb +1 -1
- data/spec/cases/parallel_sleeping_2.rb +1 -1
- data/spec/cases/parallel_start_and_kill.rb +1 -1
- data/spec/cases/parallel_with_detected_cpus.rb +1 -1
- data/spec/cases/parallel_with_nil_uses_detected_cpus.rb +1 -1
- data/spec/cases/parallel_with_set_processes.rb +1 -1
- data/spec/parallel_spec.rb +7 -6
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
task :default => :spec
|
2
2
|
require 'spec/rake/spectask'
|
3
|
-
Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color']}
|
3
|
+
Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color'] }
|
4
4
|
|
5
5
|
begin
|
6
6
|
require 'jeweler'
|
@@ -15,5 +15,5 @@ begin
|
|
15
15
|
|
16
16
|
Jeweler::GemcutterTasks.new
|
17
17
|
rescue LoadError
|
18
|
-
puts "Jeweler, or one of its dependencies, is not available. Install it with:
|
19
|
-
end
|
18
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
|
19
|
+
end
|
data/Readme.md
CHANGED
@@ -44,10 +44,11 @@ TODO
|
|
44
44
|
Authors
|
45
45
|
=======
|
46
46
|
|
47
|
-
###Contributors
|
47
|
+
### [Contributors](http://github.com/grosser/parallel/contributors)
|
48
48
|
- [Przemyslaw Wroblewski](http://github.com/lowang)
|
49
49
|
- [TJ Holowaychuk](http://vision-media.ca/)
|
50
50
|
- [Masatomo Nakano](http://twitter.com/masatomo2)
|
51
|
+
- [Fred Wu](http://fredwu.me)
|
51
52
|
|
52
53
|
[Michael Grosser](http://pragmatig.wordpress.com)
|
53
54
|
grosser.michael@gmail.com
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/lib/parallel.rb
CHANGED
@@ -2,6 +2,7 @@ require 'thread' # to get Thread.exclusive
|
|
2
2
|
|
3
3
|
class Parallel
|
4
4
|
VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
|
5
|
+
SPLAT_BUG = *[] # fix for bug/feature http://redmine.ruby-lang.org/issues/show/2422
|
5
6
|
|
6
7
|
def self.in_threads(options={:count => 2})
|
7
8
|
count, options = extract_count_from_options(options)
|
@@ -67,6 +68,7 @@ class Parallel
|
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
71
|
+
results = results.flatten(1) if SPLAT_BUG
|
70
72
|
results
|
71
73
|
end
|
72
74
|
|
data/parallel.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{parallel}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-24}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.files = [
|
15
15
|
"Rakefile",
|
data/spec/cases/each.rb
CHANGED
data/spec/cases/parallel_map.rb
CHANGED
data/spec/parallel_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('spec/spec_helper')
|
2
2
|
|
3
3
|
describe Parallel do
|
4
4
|
describe :in_processes do
|
@@ -14,7 +14,7 @@ describe Parallel do
|
|
14
14
|
`ruby spec/cases/parallel_with_nil_uses_detected_cpus.rb`.should == "HELLO\n" * @cpus
|
15
15
|
end
|
16
16
|
|
17
|
-
it "set
|
17
|
+
it "set amount of parallel processes" do
|
18
18
|
`ruby spec/cases/parallel_with_set_processes.rb`.should == "HELLO\n" * 5
|
19
19
|
end
|
20
20
|
|
@@ -29,8 +29,9 @@ describe Parallel do
|
|
29
29
|
`ruby spec/cases/parallel_start_and_kill.rb`
|
30
30
|
end
|
31
31
|
sleep 1
|
32
|
-
running_processes = `ps -f`.split("\n").map{|line| line.split(/\s+/)}
|
33
|
-
|
32
|
+
running_processes = `ps -f`.split("\n").map{ |line| line.split(/\s+/) }
|
33
|
+
uid_index = running_processes.detect{ |line| line.include?("UID") }.index("UID") + 1
|
34
|
+
parent = running_processes.detect{ |line| line.grep(/(0|)0:00(:|.)00/).any? and line.include?("ruby") }[uid_index]
|
34
35
|
`kill -2 #{parent}` #simulates Ctrl+c
|
35
36
|
}.should_not change{`ps`.split("\n").size}
|
36
37
|
Time.now.should be_close(t, 3)
|
@@ -102,7 +103,7 @@ describe Parallel do
|
|
102
103
|
end
|
103
104
|
|
104
105
|
it 'supports ranges' do
|
105
|
-
`ruby spec/cases/parallel_map_range.rb`.should == '
|
106
|
+
`ruby spec/cases/parallel_map_range.rb`.should == '[1, 2, 3, 4, 5]'
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
@@ -149,4 +150,4 @@ describe Parallel do
|
|
149
150
|
Parallel.send(:in_groups_of, [1,2,3,4], 3).should == [[1,2,3],[4]]
|
150
151
|
end
|
151
152
|
end
|
152
|
-
end
|
153
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
$LOAD_PATH
|
1
|
+
$LOAD_PATH.unshift 'lib'
|
2
2
|
require 'parallel'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 4
|
9
|
+
version: 0.4.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-24 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|