lib/cloud_crowd/models/job.rb in documentcloud-cloud-crowd-0.0.6 vs lib/cloud_crowd/models/job.rb in documentcloud-cloud-crowd-0.1.0
- old
+ new
@@ -11,11 +11,11 @@
validates_presence_of :status, :inputs, :action, :options
before_validation_on_create :set_initial_status
after_create :queue_for_workers
- before_destroy :cleanup
+ before_destroy :cleanup_assets
# Create a Job from an incoming JSON or XML request, and add it to the queue.
# TODO: Think about XML support.
def self.create_from_request(h)
self.create(
@@ -59,13 +59,13 @@
puts "Failed to fire job callback. Hmmm, what should happen here?"
end
end
# Cleaning up after a job will remove all of its files from S3. Destroying
- # a Job calls cleanup first.
- def cleanup
- AssetStore.new.cleanup_job(self)
+ # a Job calls cleanup_assets first.
+ def cleanup_assets
+ AssetStore.new.cleanup(self)
end
# Have all of the WorkUnits finished?
#--
# We could trade reads for writes here
@@ -92,10 +92,10 @@
# Retrieve the class for this Job's Action.
def action_class
klass = CloudCrowd.actions[self.action]
return klass if klass
- raise ActionNotFound, "no action named: '#{self.action}' could be found"
+ raise Error::ActionNotFound, "no action named: '#{self.action}' could be found"
end
# How complete is this Job?
def percent_complete
return 0 if splitting?
\ No newline at end of file