lib/cloud_crowd/models/work_unit.rb in cloud-crowd-0.2.9 vs lib/cloud_crowd/models/work_unit.rb in cloud-crowd-0.3.0
- old
+ new
@@ -85,20 +85,20 @@
node && node.work_units.find_by_worker_pid(pid)
end
# Convenience method for starting a new WorkUnit.
def self.start(job, action, input, status)
+ input = input.to_json unless input.is_a? String
self.create(:job => job, :action => action, :input => input, :status => status)
end
# Mark this unit as having finished successfully.
# Splitting work units are handled differently (an optimization) -- they
# immediately fire off all of their resulting WorkUnits for processing,
# without waiting for the rest of their splitting cousins to complete.
def finish(result, time_taken)
if splitting?
[parsed_output(result)].flatten.each do |new_input|
- new_input = new_input.to_json unless new_input.is_a? String
WorkUnit.start(job, action, new_input, PROCESSING)
end
self.destroy
job.set_next_status if job && job.done_splitting?
else