cloud-crowd 0.7.2 → 0.7.3
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.
- checksums.yaml +4 -4
- data/cloud-crowd.gemspec +3 -3
- data/lib/cloud-crowd.rb +1 -1
- data/lib/cloud_crowd/models/node_record.rb +6 -1
- data/lib/cloud_crowd/node.rb +18 -3
- data/lib/cloud_crowd/server.rb +7 -3
- data/test/acceptance/test_failing_work_units.rb +1 -1
- data/test/acceptance/test_node.rb +1 -1
- data/test/acceptance/test_server.rb +1 -1
- data/test/acceptance/test_word_count.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/test_action.rb +3 -3
- data/test/unit/test_command_line.rb +1 -1
- data/test/unit/test_configuration.rb +1 -1
- data/test/unit/test_job.rb +1 -1
- data/test/unit/test_node.rb +1 -1
- data/test/unit/test_node_record.rb +1 -1
- data/test/unit/test_work_unit.rb +1 -1
- data/test/unit/test_worker.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca46d87f48a34b124b8b581e0f65f3d68b5595b
|
4
|
+
data.tar.gz: d0b1df360b9a5cd87bb3183b3c49480997890e71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf7261ba8b1333302a42793a0d2c18f4c00432a5e2b58c6ad3f01526895e985b8c82da1779d96bb400c1c182529f8e3150a82221a2543141d296c9e1e977b82
|
7
|
+
data.tar.gz: bebaf475fcc3ccce3d96db36658dc7d16e6fb3b9378788ae2c3623953d646792484cef5c3a562e3fdad3b97882244830419d0da93e5d09f87212a9a4738f1aac
|
data/cloud-crowd.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'cloud-crowd'
|
3
|
-
s.version = '0.7.
|
4
|
-
s.date = '2014-
|
3
|
+
s.version = '0.7.3' # Keep version in sync with cloud-cloud.rb
|
4
|
+
s.date = '2014-05-06'
|
5
5
|
|
6
6
|
s.homepage = "http://wiki.github.com/documentcloud/cloud-crowd"
|
7
7
|
s.summary = "Parallel Processing for the Rest of Us"
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.license = "MIT"
|
17
17
|
|
18
|
-
s.authors = ['Jeremy Ashkenas', 'Ted Han']
|
18
|
+
s.authors = ['Jeremy Ashkenas', 'Ted Han', 'Nathan Stitt']
|
19
19
|
s.email = 'opensource@documentcloud.org'
|
20
20
|
s.rubyforge_project = 'cloud-crowd'
|
21
21
|
|
data/lib/cloud-crowd.rb
CHANGED
@@ -44,11 +44,16 @@ module CloudCrowd
|
|
44
44
|
result = node['/work'].post(:work_unit => unit.to_json)
|
45
45
|
unit.assign_to(self, JSON.parse(result.body)['pid'])
|
46
46
|
touch && true
|
47
|
+
rescue RestClient::RequestTimeout
|
48
|
+
# The node's gone away. Destroy it and it will check in when it comes back
|
49
|
+
puts "Node #{host} received RequestTimeout, removing it"
|
50
|
+
destroy && false
|
47
51
|
rescue RestClient::RequestFailed => e
|
48
52
|
raise e unless e.http_code == 503 && e.http_body == Node::OVERLOADED_MESSAGE
|
49
53
|
update_attribute(:busy, true) && false
|
50
|
-
rescue RestClient::Exception, Errno::ECONNREFUSED, Timeout::Error,
|
54
|
+
rescue RestClient::Exception, Errno::ECONNREFUSED, Timeout::Error, Errno::ECONNRESET=>e
|
51
55
|
# Couldn't post to node, assume it's gone away.
|
56
|
+
puts "Node #{host} received #{e.class} #{e}, removing it"
|
52
57
|
destroy && false
|
53
58
|
end
|
54
59
|
|
data/lib/cloud_crowd/node.rb
CHANGED
@@ -175,8 +175,23 @@ module CloudCrowd
|
|
175
175
|
def check_in_periodically
|
176
176
|
@check_in_thread = CloudCrowd.defer do
|
177
177
|
loop do
|
178
|
-
|
179
|
-
|
178
|
+
reply = ""
|
179
|
+
1.upto(5).each do | attempt_number |
|
180
|
+
# sleep for an ever increasing amount of time to prevent overloading the server
|
181
|
+
sleep CHECK_IN_INTERVAL * attempt_number
|
182
|
+
reply = check_in
|
183
|
+
# if we did not receive a reply, the server has went away; it
|
184
|
+
# will reply with an empty string if the check-in succeeds
|
185
|
+
if reply.nil?
|
186
|
+
puts "Failed on attempt # #{attempt_number} to check in with server"
|
187
|
+
else
|
188
|
+
break
|
189
|
+
end
|
190
|
+
end
|
191
|
+
if reply.nil?
|
192
|
+
puts "Giving up after repeated attempts to contact server"
|
193
|
+
raise SystemExit
|
194
|
+
end
|
180
195
|
end
|
181
196
|
end
|
182
197
|
end
|
@@ -200,4 +215,4 @@ module CloudCrowd
|
|
200
215
|
|
201
216
|
end
|
202
217
|
|
203
|
-
end
|
218
|
+
end
|
data/lib/cloud_crowd/server.rb
CHANGED
@@ -91,12 +91,15 @@ module CloudCrowd
|
|
91
91
|
|
92
92
|
# INTERNAL NODE API:
|
93
93
|
|
94
|
-
# A new Node will
|
94
|
+
# A new Node will put to this action to register its location and
|
95
95
|
# configuration with the central server. Triggers distribution of WorkUnits.
|
96
96
|
put '/node/:host' do
|
97
97
|
NodeRecord.check_in(params, request)
|
98
|
-
WorkUnit.distribute_to_nodes
|
99
98
|
puts "Node #{params[:host]} checked in."
|
99
|
+
CloudCrowd.defer do
|
100
|
+
sleep 15 # Give the new node awhile to start listening
|
101
|
+
WorkUnit.distribute_to_nodes
|
102
|
+
end
|
100
103
|
json nil
|
101
104
|
end
|
102
105
|
|
@@ -117,7 +120,8 @@ module CloudCrowd
|
|
117
120
|
when 'failed' then current_work_unit.fail(params[:output], params[:time])
|
118
121
|
else error(500, "Completing a work unit must specify status.")
|
119
122
|
end
|
120
|
-
WorkUnit.distribute_to_nodes
|
123
|
+
CloudCrowd.defer { WorkUnit.distribute_to_nodes }
|
124
|
+
|
121
125
|
json nil
|
122
126
|
end
|
123
127
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
# A Worker Daemon needs to be running to perform this integration test.
|
4
|
-
class FailingWorkUnitsTest < Test
|
4
|
+
class FailingWorkUnitsTest < Minitest::Test
|
5
5
|
|
6
6
|
should "retry work units when they fail" do
|
7
7
|
WorkUnit.expects(:distribute_to_nodes).returns(true)
|
data/test/test_helper.rb
CHANGED
@@ -19,7 +19,7 @@ CloudCrowd.configure_database(here + '/config/database.yml')
|
|
19
19
|
|
20
20
|
require "#{CloudCrowd::ROOT}/test/blueprints.rb"
|
21
21
|
|
22
|
-
class Test
|
22
|
+
class Minitest::Test
|
23
23
|
include CloudCrowd
|
24
24
|
include Shoulda::Matchers::ActiveRecord
|
25
25
|
extend Shoulda::Matchers::ActiveRecord
|
data/test/unit/test_action.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
class EmptyAction < CloudCrowd::Action
|
8
8
|
end
|
9
9
|
|
10
|
-
class ActionTest < Test
|
10
|
+
class ActionTest < Minitest::Test
|
11
11
|
|
12
12
|
context "A CloudCrowd::Action" do
|
13
13
|
|
@@ -18,7 +18,7 @@ class ActionTest < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
should "throw an exception if the 'process' method isn't implemented" do
|
21
|
-
|
21
|
+
assert_raises(NotImplementedError) { EmptyAction.new(*@args).process }
|
22
22
|
end
|
23
23
|
|
24
24
|
should "have downloaded the input URL to local storage" do
|
@@ -55,7 +55,7 @@ class ActionTest < Test::Unit::TestCase
|
|
55
55
|
|
56
56
|
should "raise an exception when backticks fail" do
|
57
57
|
def @action.process; `utter failure 2>&1`; end
|
58
|
-
|
58
|
+
assert_raises(CloudCrowd::Error::CommandFailed) { @action.process }
|
59
59
|
end
|
60
60
|
|
61
61
|
should "be able to download a remote file" do
|
data/test/unit/test_job.rb
CHANGED
data/test/unit/test_node.rb
CHANGED
data/test/unit/test_work_unit.rb
CHANGED
data/test/unit/test_worker.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud-crowd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
8
8
|
- Ted Han
|
9
|
+
- Nathan Stitt
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2014-
|
13
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activerecord
|