cloud-crowd 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88fe358ade9e482b1e3babde6470481f0a2610b4
4
- data.tar.gz: 875f598e6160a237d322dd9fa2572e8519952cc7
3
+ metadata.gz: cca46d87f48a34b124b8b581e0f65f3d68b5595b
4
+ data.tar.gz: d0b1df360b9a5cd87bb3183b3c49480997890e71
5
5
  SHA512:
6
- metadata.gz: df444794a6c2161fa6573e1efb85e1b045d65af5bed1681c842ca46359d433fe8e1b2116cfd89791e04e08eece282607da5a2117a2336e274dac1e906eb476ad
7
- data.tar.gz: eb4cac079f21ff387415e1742c376f2c77f3019bf20067be0eaa91cc07bb82438af9f3e6aac3c9a58f966c2dc61668bd6fe6e081109c5aa45ad4e6a8beab57c9
6
+ metadata.gz: 1cf7261ba8b1333302a42793a0d2c18f4c00432a5e2b58c6ad3f01526895e985b8c82da1779d96bb400c1c182529f8e3150a82221a2543141d296c9e1e977b82
7
+ data.tar.gz: bebaf475fcc3ccce3d96db36658dc7d16e6fb3b9378788ae2c3623953d646792484cef5c3a562e3fdad3b97882244830419d0da93e5d09f87212a9a4738f1aac
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cloud-crowd'
3
- s.version = '0.7.2' # Keep version in sync with cloud-cloud.rb
4
- s.date = '2014-04-17'
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
 
@@ -27,7 +27,7 @@ require 'socket'
27
27
  require 'net/http'
28
28
  require 'cloud_crowd/exceptions'
29
29
  require 'rest_client'
30
-
30
+ require 'pathname'
31
31
  require 'active_model_serializers'
32
32
  ActiveModel::Serializer.root = false
33
33
 
@@ -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, RestClient::RequestTimeout, Errno::ECONNRESET
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
 
@@ -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
- sleep CHECK_IN_INTERVAL
179
- check_in
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
@@ -91,12 +91,15 @@ module CloudCrowd
91
91
 
92
92
  # INTERNAL NODE API:
93
93
 
94
- # A new Node will this this action to register its location and
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::Unit::TestCase
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)
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class NodeAcceptanceTest < Test::Unit::TestCase
3
+ class NodeAcceptanceTest < Minitest::Test
4
4
 
5
5
  include Rack::Test::Methods
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ServerTest < Test::Unit::TestCase
3
+ class ServerTest < Minitest::Test
4
4
 
5
5
  include Rack::Test::Methods
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class WordCountTest < Test::Unit::TestCase
3
+ class WordCountTest < Minitest::Test
4
4
 
5
5
  context "the word_count action" do
6
6
 
@@ -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::Unit::TestCase
22
+ class Minitest::Test
23
23
  include CloudCrowd
24
24
  include Shoulda::Matchers::ActiveRecord
25
25
  extend Shoulda::Matchers::ActiveRecord
@@ -7,7 +7,7 @@ end
7
7
  class EmptyAction < CloudCrowd::Action
8
8
  end
9
9
 
10
- class ActionTest < Test::Unit::TestCase
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
- assert_raise(NotImplementedError) { EmptyAction.new(*@args).process }
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
- assert_raise(CloudCrowd::Error::CommandFailed) { @action.process }
58
+ assert_raises(CloudCrowd::Error::CommandFailed) { @action.process }
59
59
  end
60
60
 
61
61
  should "be able to download a remote file" do
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class CommandLineTest < Test::Unit::TestCase
3
+ class CommandLineTest < Minitest::Test
4
4
 
5
5
  context "A CloudCrowd::CommandLine" do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ConfigurationTest < Test::Unit::TestCase
3
+ class ConfigurationTest < Minitest::Test
4
4
 
5
5
  context "CloudCrowd Configuration" do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class JobTest < Test::Unit::TestCase
3
+ class JobTest < Minitest::Test
4
4
 
5
5
  context "A CloudCrowd Job" do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class NodeUnitTest < Test::Unit::TestCase
3
+ class NodeUnitTest < Minitest::Test
4
4
 
5
5
  context "A Node" do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class NodeRecordTest < Test::Unit::TestCase
3
+ class NodeRecordTest < Minitest::Test
4
4
 
5
5
  context "A NodeRecord" do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class WorkUnitTest < Test::Unit::TestCase
3
+ class WorkUnitTest < Minitest::Test
4
4
 
5
5
  context "A WorkUnit" do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class WorkerTest < Test::Unit::TestCase
3
+ class WorkerTest < Minitest::Test
4
4
 
5
5
  context "A CloudCrowd::Worker" do
6
6
 
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.2
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-04-17 00:00:00.000000000 Z
13
+ date: 2014-05-06 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: activerecord