arya-pandemic 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +1 -0
- data/README.markdown +6 -4
- data/Rakefile +1 -1
- data/examples/server/word_count_server.rb +1 -1
- data/lib/pandemic/server_side/handler.rb +2 -2
- data/lib/pandemic/server_side/server.rb +1 -1
- data/pandemic.gemspec +5 -6
- data/test/handler_test.rb +1 -1
- data/test/server_test.rb +1 -1
- metadata +5 -5
data/Manifest
CHANGED
data/README.markdown
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Pandemic
|
2
|
-
Pandemic is a map-reduce framework.
|
2
|
+
Pandemic is a map-reduce-ish framework. It allows you to partition requests and distribute them as you please, then process the request (or parts of it) on any number of nodes, and then reduce the response however you please. It's designed to serve requests in real-time, but can also be used for offline tasks.
|
3
3
|
|
4
|
-
It's different from the typical map-reduce framework in that it doesn't have a master-worker structure. Every node can map
|
4
|
+
It's different from the typical map-reduce framework in that it doesn't have a master-worker structure. Every node does can do everything. It's actually not strictly a map-reduce framework, it's a bit more lenient on what you can do to your data/request other than map and reduce.
|
5
5
|
|
6
6
|
The framework is designed to be as flexible as possible, there is no rigid request format, or API, you can specify it however you want. You can send it http-style headers and a body, you can send it JSON, or you can even just send it a single line and have it do whatever you want. The only requirement is that you write your handler to appropriately act on the request and return the response.
|
7
7
|
|
@@ -21,9 +21,9 @@ The framework is designed to be as flexible as possible, there is no rigid reque
|
|
21
21
|
pandemic_server.handler = Handler # Pandemic will call the initializer once per process
|
22
22
|
pandemic_server.start.join
|
23
23
|
|
24
|
-
In this example, the handler doesn't define the
|
24
|
+
In this example, the handler doesn't define the partition or reduce methods, and the defaults are used. The default for each is as follows:
|
25
25
|
|
26
|
-
*
|
26
|
+
* partition: Send the full request body to every connected node
|
27
27
|
* process: Return the body (do nothing)
|
28
28
|
* reduce: Concatenate all the responses
|
29
29
|
|
@@ -117,6 +117,8 @@ The servers are going to try to bind to localhost:4000 and localhost:4001 so mak
|
|
117
117
|
By default, the handler runs in the same Ruby process as Pandemic. By setting the fork\_for\_processor to true in pandemic\_server.yml, you can have Pandemic fork to new processes to run the process method. This is particularly useful when your process method goes to MySQL which locks the entire process until MySQL returns.
|
118
118
|
|
119
119
|
## Change History
|
120
|
+
Version 0.3.1
|
121
|
+
* Changed map to partition to more accurately reflect what it does. This breaks backwards compatibility, but all you have to do is rename your method.
|
120
122
|
Version 0.3.0
|
121
123
|
|
122
124
|
* Pandemic can now fork to call the process method
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('pandemic', '0.3.
|
5
|
+
Echoe.new('pandemic', '0.3.1') do |p|
|
6
6
|
p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
|
7
7
|
p.url = "https://github.com/arya/pandemic/"
|
8
8
|
p.author = "Arya Asemanfar"
|
@@ -3,7 +3,7 @@ require 'pandemic'
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
class WordCounter < Pandemic::ServerSide::Handler
|
6
|
-
def
|
6
|
+
def partition(request, servers)
|
7
7
|
# select only the alive servers (non-disconnected)
|
8
8
|
only_alive = servers.keys.select{|k| servers[k] != :disconnected}
|
9
9
|
|
@@ -115,7 +115,7 @@ module Pandemic
|
|
115
115
|
|
116
116
|
def handle_client_request(request)
|
117
117
|
info("Handling client request")
|
118
|
-
map = @handler_instance.
|
118
|
+
map = @handler_instance.partition(request, connection_statuses)
|
119
119
|
request.max_responses = map.size
|
120
120
|
debug("Sending client request to #{map.size} handlers (#{request.hash})")
|
121
121
|
|
data/pandemic.gemspec
CHANGED
@@ -2,27 +2,26 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{pandemic}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Arya Asemanfar"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-06-18}
|
10
10
|
s.description = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
|
11
11
|
s.email = %q{aryaasemanfar@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "README.markdown"]
|
13
|
-
s.files = ["examples/client/client.rb", "examples/client/constitution.txt", "examples/client/pandemic_client.yml", "examples/server/pandemic_server.yml", "examples/server/word_count_server.rb", "lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "Manifest", "MIT-LICENSE", "
|
14
|
-
s.has_rdoc = true
|
13
|
+
s.files = ["examples/client/client.rb", "examples/client/constitution.txt", "examples/client/pandemic_client.yml", "examples/server/pandemic_server.yml", "examples/server/word_count_server.rb", "lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "Manifest", "MIT-LICENSE", "pandemic.gemspec", "Rakefile", "README.markdown", "test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
|
15
14
|
s.homepage = %q{https://github.com/arya/pandemic/}
|
16
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pandemic", "--main", "README.markdown"]
|
17
16
|
s.require_paths = ["lib"]
|
18
17
|
s.rubyforge_project = %q{pandemic}
|
19
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.4}
|
20
19
|
s.summary = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
|
21
20
|
s.test_files = ["test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
|
22
21
|
|
23
22
|
if s.respond_to? :specification_version then
|
24
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
-
s.specification_version =
|
24
|
+
s.specification_version = 3
|
26
25
|
|
27
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
27
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
data/test/handler_test.rb
CHANGED
@@ -21,7 +21,7 @@ class HandlerTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
should "map to all non-disconnected nodes" do
|
23
23
|
@request.expects(:body).twice.returns("123")
|
24
|
-
map = @handler.
|
24
|
+
map = @handler.partition(@request, @servers)
|
25
25
|
# see setup for @servers
|
26
26
|
assert_equal 2, map.size
|
27
27
|
assert_equal "123", map[1]
|
data/test/server_test.rb
CHANGED
@@ -94,7 +94,7 @@ class ServerTest < Test::Unit::TestCase
|
|
94
94
|
request = mock()
|
95
95
|
request.expects(:hash).at_least_once.returns("abcddef134123")
|
96
96
|
@peer.expects(:connected?).returns(true)
|
97
|
-
handler.expects(:
|
97
|
+
handler.expects(:partition).with(request, is_a(Hash)).returns({"localhost:4000" => "1", "localhost:4001" => "2"})
|
98
98
|
request.expects(:max_responses=).with(2)
|
99
99
|
@peer.expects(:client_request).with(request, "2")
|
100
100
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arya-pandemic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arya Asemanfar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -80,9 +80,9 @@ files:
|
|
80
80
|
- lib/pandemic.rb
|
81
81
|
- Manifest
|
82
82
|
- MIT-LICENSE
|
83
|
+
- pandemic.gemspec
|
83
84
|
- Rakefile
|
84
85
|
- README.markdown
|
85
|
-
- pandemic.gemspec
|
86
86
|
- test/client_test.rb
|
87
87
|
- test/connection_pool_test.rb
|
88
88
|
- test/functional_test.rb
|
@@ -93,7 +93,7 @@ files:
|
|
93
93
|
- test/server_test.rb
|
94
94
|
- test/test_helper.rb
|
95
95
|
- test/util_test.rb
|
96
|
-
has_rdoc:
|
96
|
+
has_rdoc: false
|
97
97
|
homepage: https://github.com/arya/pandemic/
|
98
98
|
post_install_message:
|
99
99
|
rdoc_options:
|
@@ -122,7 +122,7 @@ requirements: []
|
|
122
122
|
rubyforge_project: pandemic
|
123
123
|
rubygems_version: 1.2.0
|
124
124
|
signing_key:
|
125
|
-
specification_version:
|
125
|
+
specification_version: 3
|
126
126
|
summary: Distribute MapReduce to any of the workers and it will spread, like a pandemic.
|
127
127
|
test_files:
|
128
128
|
- test/client_test.rb
|