process_pool 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/VERSION +1 -1
- data/bin/convert_to_should_syntax +1 -1
- data/bin/edit_json.rb +1 -1
- data/bin/prettify_json.rb +1 -1
- data/bin/rake +1 -1
- data/lib/process_pool.rb +4 -0
- data/lib/simple_logger.rb +2 -0
- data/lib/simple_queue.rb +2 -0
- data/process_pool.gemspec +59 -0
- data/test/process_pool_test.rb +15 -0
- metadata +7 -12
- data/bin/flay +0 -3
- data/bin/flog +0 -3
- data/bin/rcov +0 -3
- data/bin/ruby_parse +0 -3
- data/bin/rubyforge +0 -3
- data/bin/sow +0 -3
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bin/edit_json.rb
CHANGED
data/bin/prettify_json.rb
CHANGED
data/bin/rake
CHANGED
data/lib/process_pool.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'init')
|
2
|
+
|
1
3
|
class ProcessPool
|
2
4
|
|
3
5
|
class InvalidStateError < StandardError;
|
@@ -53,6 +55,8 @@ class ProcessPool
|
|
53
55
|
worker_pids.each do |pid|
|
54
56
|
Process.wait(pid)
|
55
57
|
end
|
58
|
+
|
59
|
+
queue.close
|
56
60
|
end
|
57
61
|
|
58
62
|
def is_running?
|
data/lib/simple_logger.rb
CHANGED
data/lib/simple_queue.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{process_pool}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Adam Pohorecki"]
|
12
|
+
s.date = %q{2010-01-18}
|
13
|
+
s.email = %q{adam@pohorecki.pl}
|
14
|
+
s.executables = ["edit_json.rb", "rake", "prettify_json.rb", "convert_to_should_syntax"]
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE",
|
23
|
+
"README",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/init.rb",
|
27
|
+
"lib/process_pool.rb",
|
28
|
+
"lib/simple_logger.rb",
|
29
|
+
"lib/simple_queue.rb",
|
30
|
+
"process_pool.gemspec",
|
31
|
+
"test/process_pool_test.rb",
|
32
|
+
"test/simple_queue_test.rb",
|
33
|
+
"test/test_helper.rb"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/psyho/process_pool}
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
39
|
+
s.summary = %q{ProcessPool with interchangeable job queue backends for Ruby}
|
40
|
+
s.test_files = [
|
41
|
+
"test/process_pool_test.rb",
|
42
|
+
"test/simple_queue_test.rb",
|
43
|
+
"test/test_helper.rb"
|
44
|
+
]
|
45
|
+
|
46
|
+
if s.respond_to? :specification_version then
|
47
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
+
s.specification_version = 3
|
49
|
+
|
50
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<json>, [">= 0"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<json>, [">= 0"])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
data/test/process_pool_test.rb
CHANGED
@@ -8,6 +8,9 @@ class SampleQueue
|
|
8
8
|
self.data = []
|
9
9
|
end
|
10
10
|
|
11
|
+
def close
|
12
|
+
end
|
13
|
+
|
11
14
|
def uri
|
12
15
|
'test-queue'
|
13
16
|
end
|
@@ -175,12 +178,23 @@ class ProcessPoolTest < Test::Unit::TestCase
|
|
175
178
|
Process.expects(:wait).with(1).times(3).returns(0)
|
176
179
|
@pool.shutdown
|
177
180
|
end
|
181
|
+
|
182
|
+
should "close the queue" do
|
183
|
+
@queue.expects(:close)
|
184
|
+
Process.stubs(:wait => 0)
|
185
|
+
@pool.shutdown
|
186
|
+
end
|
178
187
|
end
|
179
188
|
|
180
189
|
context "with default queue and two workers" do
|
181
190
|
setup do
|
182
191
|
@pool = ProcessPool.new(1)
|
183
192
|
2.times { |n| @pool.schedule(SampleTask, n) }
|
193
|
+
@pool.send(:queue).stubs(:close => nil) # so that we can inspect the queue contents
|
194
|
+
end
|
195
|
+
|
196
|
+
teardown do
|
197
|
+
SimpleQueue.get(@pool.send(:queue).uri).close
|
184
198
|
end
|
185
199
|
|
186
200
|
should "empty the queue before returning from shutdown" do
|
@@ -213,6 +227,7 @@ class ProcessPoolTest < Test::Unit::TestCase
|
|
213
227
|
@pool.shutdown
|
214
228
|
assert_equal 0, @pool.send(:queue).size
|
215
229
|
end
|
230
|
+
|
216
231
|
end
|
217
232
|
|
218
233
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process_pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Pohorecki
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-18 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -25,16 +25,10 @@ dependencies:
|
|
25
25
|
description:
|
26
26
|
email: adam@pohorecki.pl
|
27
27
|
executables:
|
28
|
-
- convert_to_should_syntax
|
29
|
-
- rake
|
30
|
-
- rubyforge
|
31
|
-
- flog
|
32
|
-
- ruby_parse
|
33
|
-
- flay
|
34
|
-
- rcov
|
35
28
|
- edit_json.rb
|
36
|
-
-
|
29
|
+
- rake
|
37
30
|
- prettify_json.rb
|
31
|
+
- convert_to_should_syntax
|
38
32
|
extensions: []
|
39
33
|
|
40
34
|
extra_rdoc_files:
|
@@ -51,6 +45,7 @@ files:
|
|
51
45
|
- lib/process_pool.rb
|
52
46
|
- lib/simple_logger.rb
|
53
47
|
- lib/simple_queue.rb
|
48
|
+
- process_pool.gemspec
|
54
49
|
- test/process_pool_test.rb
|
55
50
|
- test/simple_queue_test.rb
|
56
51
|
- test/test_helper.rb
|
@@ -83,6 +78,6 @@ signing_key:
|
|
83
78
|
specification_version: 3
|
84
79
|
summary: ProcessPool with interchangeable job queue backends for Ruby
|
85
80
|
test_files:
|
86
|
-
- test/test_helper.rb
|
87
|
-
- test/simple_queue_test.rb
|
88
81
|
- test/process_pool_test.rb
|
82
|
+
- test/simple_queue_test.rb
|
83
|
+
- test/test_helper.rb
|
data/bin/flay
DELETED
data/bin/flog
DELETED
data/bin/rcov
DELETED
data/bin/ruby_parse
DELETED
data/bin/rubyforge
DELETED
data/bin/sow
DELETED