cloud-crowd 0.7.2.beta → 0.7.2.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80888bac2f20a7754fce2189300bc2eee29d9d83
4
- data.tar.gz: b972fd367a79015365f3a8d96390f2a968703faf
3
+ metadata.gz: e9e74473f191d5e59232845fb04e2d0961f783bb
4
+ data.tar.gz: 6e3ef77f35dfb2b453d31653d510dc22a00c0d09
5
5
  SHA512:
6
- metadata.gz: 8bc1b167b09984f551a20110ab40294f5a7da6b6843abb0f49c5b753309e5c85e793f8f1d93d7f97e27832b726e9a7989a27bb64a64dbe0aa8442ef2d0dee211
7
- data.tar.gz: 434cc845d94bc70d01c0d5aee4af0a82b8e3ff5b54442432b307dd5a83bb3ef3ad0d11cad0b6ebf75bcac35d61b57982d2fce0ea8a5b6f49fe29d04e977741df
6
+ metadata.gz: b1ab696032f37e92434080ab93d823e0062de027f0db79508f5950c2628bd65ccd30742da5d4ec2317fe82a42403f810cf2f7d82f9cc8eef0f04fec02f4bb40d
7
+ data.tar.gz: d83a98cdc4d0d76588ca80cf6997abffea5916bab3be17205bdeda2b07b67625c44de959a2b7ef2efc3004d3b1b1339925da0790bd1b28d0e0d572491b017515
data/cloud-crowd.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cloud-crowd'
3
- s.version = '0.7.2.beta' # Keep version in sync with cloud-cloud.rb
3
+ s.version = '0.7.2.pre' # Keep version in sync with cloud-cloud.rb
4
4
  s.date = '2014-04-06'
5
5
 
6
6
  s.homepage = "http://wiki.github.com/documentcloud/cloud-crowd"
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.add_dependency 'json', ['>= 1.1.7']
35
35
  s.add_dependency 'rest-client', ['>= 1.4']
36
36
  s.add_dependency 'thin', ['>= 1.2.4']
37
- s.add_dependency 'rake'
37
+ s.add_dependency 'rake'
38
38
 
39
39
  if s.respond_to?(:add_development_dependency)
40
40
  s.add_development_dependency 'faker', ['>= 0.3.1']
data/lib/cloud-crowd.rb CHANGED
@@ -100,10 +100,6 @@ module CloudCrowd
100
100
  @config_path = File.expand_path(File.dirname(config_path))
101
101
  @config = YAML.load(ERB.new(File.read(config_path)).result)
102
102
  @config[:work_unit_retries] ||= MIN_RETRIES
103
- if @config[:actions_path]
104
- path = Pathname.new( @config[:actions_path] ).realpath
105
- $LOAD_PATH.unshift( path ) unless $LOAD_PATH.include?( path )
106
- end
107
103
  end
108
104
 
109
105
  # Configure the CloudCrowd central database (and connect to it), by passing
@@ -120,16 +116,6 @@ module CloudCrowd
120
116
  end
121
117
  end
122
118
 
123
- # Starts a new thread with a ActiveRecord connection_pool
124
- # and yields for peforming work inside the blocks
125
- def defer
126
- Thread.new do
127
- ActiveRecord::Base.connection_pool.with_connection do
128
- yield
129
- end
130
- end
131
- end
132
-
133
119
  # Get a reference to the central server, including authentication if
134
120
  # configured.
135
121
  def central_server
@@ -1,4 +1,4 @@
1
- require 'aws'
1
+ gem 'right_aws'
2
2
 
3
3
  module CloudCrowd
4
4
  class AssetStore
@@ -14,8 +14,11 @@ module CloudCrowd
14
14
  key, secret = CloudCrowd.config[:aws_access_key], CloudCrowd.config[:aws_secret_key]
15
15
  valid_conf = [bucket_name, key, secret].all? {|s| s.is_a? String }
16
16
  raise Error::MissingConfiguration, "An S3 account must be configured in 'config.yml' before 's3' storage can be used" unless valid_conf
17
- @s3 = ::AWS::S3.new(:access_key_id => key, :secret_access_key => secret, :secure => !!@use_auth)
18
- @bucket = (@s3.buckets[bucket_name].exists? ? @s3.buckets[bucket_name] : @s3.buckets.create(bucket_name))
17
+ protocol = @use_auth ? 'https' : 'http'
18
+ port = @use_auth ? 443 : 80
19
+ @s3 = RightAws::S3.new(key, secret, :protocol => protocol, :port => port)
20
+ @bucket = @s3.bucket(bucket_name)
21
+ @bucket = @s3.bucket(bucket_name, true) unless @bucket
19
22
  end
20
23
 
21
24
  # Save a finished file from local storage to S3. Save it publicly unless
@@ -54,7 +54,7 @@ module CloudCrowd
54
54
  if complete?
55
55
  update_attributes(:outputs => outs, :time => time_taken)
56
56
  puts "Job ##{id} (#{action}) #{display_status}." unless ENV['RACK_ENV'] == 'test'
57
- CloudCrowd.defer { fire_callback } if callback_url
57
+ Thread.new { fire_callback } if callback_url
58
58
  end
59
59
  self
60
60
  end
@@ -80,7 +80,7 @@ module CloudCrowd
80
80
  def fire_callback
81
81
  begin
82
82
  response = RestClient.post(callback_url, {:job => self.to_json})
83
- CloudCrowd.defer { self.destroy } if response && response.code == 201
83
+ Thread.new { self.destroy } if response && response.code == 201
84
84
  rescue RestClient::Exception => e
85
85
  puts "Job ##{id} (#{action}) failed to fire callback: #{callback_url}"
86
86
  end
@@ -188,4 +188,4 @@ module CloudCrowd
188
188
  end
189
189
 
190
190
  end
191
- end
191
+ end
@@ -116,7 +116,7 @@ module CloudCrowd
116
116
  # Redistribute in a separate thread to avoid delaying shutdown.
117
117
  def redistribute_work_units
118
118
  release_work_units
119
- CloudCrowd.defer { WorkUnit.distribute_to_nodes }
119
+ Thread.new { WorkUnit.distribute_to_nodes }
120
120
  end
121
121
 
122
122
  end
@@ -65,7 +65,6 @@ module CloudCrowd
65
65
 
66
66
  # When creating a node, specify the port it should run on.
67
67
  def initialize(options={})
68
- super()
69
68
  require 'json'
70
69
  CloudCrowd.identity = :node
71
70
  @central = CloudCrowd.central_server
@@ -92,7 +91,7 @@ module CloudCrowd
92
91
  @server.daemonize if @daemon
93
92
  trap_signals
94
93
  asset_store
95
- @server_thread = CloudCrowd.defer { @server.start }
94
+ @server_thread = Thread.new { @server.start }
96
95
  check_in(true)
97
96
  check_in_periodically
98
97
  monitor_system if @max_load || @min_memory
@@ -159,7 +158,7 @@ module CloudCrowd
159
158
  # average and the amount of free memory remaining. If we transition out of
160
159
  # the overloaded state, let central know.
161
160
  def monitor_system
162
- @monitor_thread = CloudCrowd.defer do
161
+ @monitor_thread = Thread.new do
163
162
  loop do
164
163
  was_overloaded = @overloaded
165
164
  @overloaded = overloaded?
@@ -173,7 +172,7 @@ module CloudCrowd
173
172
  # will assume that the node has gone down. Checking in will let central know
174
173
  # it's still online.
175
174
  def check_in_periodically
176
- @check_in_thread = CloudCrowd.defer do
175
+ @check_in_thread = Thread.new do
177
176
  loop do
178
177
  sleep CHECK_IN_INTERVAL
179
178
  check_in
@@ -71,7 +71,7 @@ module CloudCrowd
71
71
  # Distributes all work units to available nodes.
72
72
  post '/jobs' do
73
73
  job = Job.create_from_request(JSON.parse(params[:job]))
74
- CloudCrowd.defer { WorkUnit.distribute_to_nodes }
74
+ Thread.new { WorkUnit.distribute_to_nodes }
75
75
  puts "Job ##{job.id} (#{job.action}) started." unless ENV['RACK_ENV'] == 'test'
76
76
  json job
77
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud-crowd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2.beta
4
+ version: 0.7.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -293,8 +293,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
293
  version: 1.3.1
294
294
  requirements: []
295
295
  rubyforge_project: cloud-crowd
296
- rubygems_version: 2.2.2
296
+ rubygems_version: 2.2.1
297
297
  signing_key:
298
298
  specification_version: 4
299
299
  summary: Parallel Processing for the Rest of Us
300
300
  test_files: []
301
+ has_rdoc: