cloud-crowd 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cloud-crowd'
3
- s.version = '0.2.9' # Keep version in sync with cloud-cloud.rb
4
- s.date = '2009-11-03'
3
+ s.version = '0.3.0' # Keep version in sync with cloud-cloud.rb
4
+ s.date = '2009-11-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"
@@ -44,7 +44,7 @@ module CloudCrowd
44
44
  autoload :WorkUnit, 'cloud_crowd/models'
45
45
 
46
46
  # Keep this version in sync with the gemspec.
47
- VERSION = '0.2.9'
47
+ VERSION = '0.3.0'
48
48
 
49
49
  # Increment the schema version when there's a backwards incompatible change.
50
50
  SCHEMA_VERSION = 3
@@ -45,7 +45,7 @@ module CloudCrowd
45
45
  return unless all_work_units_complete?
46
46
  set_next_status
47
47
  outs = gather_outputs_from_work_units
48
- return queue_for_workers(outs) if merging?
48
+ return queue_for_workers([outs]) if merging?
49
49
  if complete?
50
50
  update_attributes(:outputs => outs, :time => time_taken)
51
51
  Thread.new { fire_callback } if callback_url
@@ -177,7 +177,7 @@ module CloudCrowd
177
177
  # away.
178
178
  def queue_for_workers(input=nil)
179
179
  input ||= JSON.parse(self.inputs)
180
- [input].flatten.each {|i| WorkUnit.start(self, action, i, status) }
180
+ input.each {|i| WorkUnit.start(self, action, i, status) }
181
181
  self
182
182
  end
183
183
 
@@ -87,6 +87,7 @@ module CloudCrowd
87
87
 
88
88
  # Convenience method for starting a new WorkUnit.
89
89
  def self.start(job, action, input, status)
90
+ input = input.to_json unless input.is_a? String
90
91
  self.create(:job => job, :action => action, :input => input, :status => status)
91
92
  end
92
93
 
@@ -97,7 +98,6 @@ module CloudCrowd
97
98
  def finish(result, time_taken)
98
99
  if splitting?
99
100
  [parsed_output(result)].flatten.each do |new_input|
100
- new_input = new_input.to_json unless new_input.is_a? String
101
101
  WorkUnit.start(job, action, new_input, PROCESSING)
102
102
  end
103
103
  self.destroy
@@ -65,6 +65,11 @@ class JobTest < Test::Unit::TestCase
65
65
  assert job.splitting?
66
66
  end
67
67
 
68
+ should "not accidentally flatten array inputs" do
69
+ job = Job.create_from_request({'inputs' => [[1,2], [3,4]], 'action' => 'process_pdfs'})
70
+ assert JSON.parse(job.work_units.first.input) == [1,2]
71
+ end
72
+
68
73
  should "fire a callback when a job has finished, successfully or not" do
69
74
  @job.update_attribute(:callback_url, 'http://example.com/callback')
70
75
  Job.any_instance.stubs(:fire_callback).returns(true)
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.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-03 00:00:00 -05:00
12
+ date: 2009-11-06 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency