[Backgroundrb-devel] problem with worker status

Frank Schwach f.schwach at uea.ac.uk
Wed Mar 19 09:57:03 EDT 2008


I have a page were users can start jobs that may take several hours to
run. BackgrounDrb is perfect for me and seems to be working well most of
the time but some times I have the following problem:

My worker is set up like this:

class UploadWorker < BackgrounDRb::MetaWorker
  set_worker_name :upload_worker

  def create(args = nil )
    file = args[:file]
    sample_id = args[:sample_id]
    @user_id = args[:user_id]
    @submission_time = Time.now
    percent_complete = 0
    total_count = get_total_count(file)
    register_status(:percent_complete => percent_complete, :total =>

<<< some long running task >>>

Now when I fire up the backroundrb server and a rails console
and ask for a new worker like this:

>> jk = MiddleMan.new_worker(:worker => :upload_worker, :job_key =>
"123", :data => data)

(where data = {:file => some_file} )

most of the time I get the jobkey returned and the job works and I can
ask the status with
>> MiddleMan.ask_status(:worker => :upload_worker, :job_key => "123")

But sometimes I get the jobkey returned from the initial request but the
worker seems to fail to register its status. In some cases the job is
actually running though but not always. I don't understand what could be
causing this. Has anybody else experienced something like that?
The failures seem to be completely random to me.

More information about the Backgroundrb-devel mailing list