Have you tried checking logs? Could be that your worker just hangs
at some code in some cases? Sounds like it. I have similar setup,
same calls, 10-30 minute running workers, no problems.
While debugging I did insert logger.info at various critical places
inside the worker to track what it's doing, this helps understand if
it fails prematurely.
Frank Schwach wrote:
> Hi,
>
> 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
> set_no_auto_load(true)
>
> 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 =>
> total_count)
>
> <<< some long running task >>>
> exit
> end
> end
>
> 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.
>
> _______________________________________________
> Backgroundrb-devel mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel