class Resque::Plugins::Mission::Job

Public Class Methods

on_failure_1111_store_progress(e, *args) click to toggle source

Internal: resque on failure callback, sorted Takes our progress object and injects it back into the arguments hash so that when the job is retried it knows where to resume.

# File lib/resque/plugins/mission.rb, line 121
def self.on_failure_1111_store_progress(e, *args)
  args.last['progress'] = e.instance_variable_get :@job_progress
end
queue() click to toggle source

Internal: used by Resque::JobWithStatus to get the queue name

# File lib/resque/plugins/mission.rb, line 98
def self.queue
  self::TASK_CLASS.queue
end

Public Instance Methods

on_failure(e) click to toggle source

Internal: used by Resque::JobWithStatus to handle failure Stores the progress object on the exception so we can pass it through to the resque callback and store it in the failure.

# File lib/resque/plugins/mission.rb, line 113
def on_failure(e)
  e.instance_variable_set :@job_progress, @options['progress']
  raise e
end
perform() click to toggle source

Internal: called by Resque::JobWithStatus to perform the job

# File lib/resque/plugins/mission.rb, line 103
def perform
  task = self.class::TASK_CLASS.create_from_options(@options['args'])
  @options['progress'] = Progress[@options['progress'] || {}]
  task.call(@options['progress']) {|idx,total,msg| at idx, total, msg }
  completed
end