[Backgroundrb-devel] How do you mark a queued job as finished? ( ????? "persistent_job.finish!" ?????)

Chris Johnson wchrisjohnson at gmail.com
Tue May 12 23:50:15 EDT 2009


Hi,

As I understand from reading the list, when you queue a task to be  
executed, you need to issue some variation of the above command to  
mark the task as completed.

Given that I am queuing the task from my rails app, and the task runs  
within my worker, I assume I need to mark the job as finished in the  
method of that same worker class that does the work. Could someone  
give me a better example of how (syntax-wise) to issue that command  
properly?

For example, here's my worker:


class ReportingWorker < BackgrounDRb::MetaWorker
   set_worker_name :reporting_worker
   set_no_auto_load false

   def create(args=nil)
     logger.info "ReportingWorker started."
   end

   def create_export(args)
     work_order_id = args[0]
     user_id = args[1]

     # DO STUFF HERE
     # FINISHED!

     # HOW DO I MARK IT AS FINISHED IN THE QUEUE ?????
     persistent_job.finish!

   end # create_export
end


So, how do I mark the job as finished?

???

self.finish!

???



Chris


More information about the Backgroundrb-devel mailing list