[Backgroundrb-devel] BackgrounDRb newbie stuck at first base. Fresh pair of eyes needed

Charles Brian Quinn me at seebq.com
Thu Oct 12 11:49:59 EDT 2006


should it be:

s = MiddleMan.get_worker(:test_scraper)

?

On 10/12/06, Chris T <ctmailinglists at googlemail.com> wrote:
> Can't believe I can't see the problem here, but after a few hours
> bashing my head on a brick wall, going to risk looking stupid by seeing
> if anyone can point out my idiocy (that's the worst thing about coding
> on your own).
>
> Trying to get BackgrounDRb to take over the scraping task which is
> currently being done in a Rails controller. That's not the problem at
> the moment, as I can't even get past first base. For some reason, it
> doesn't seem to be setting up my worker class properly.
>
> Here's my worker class def:
>
>     |class ScrapeWorker < BackgrounDRb::Rails
>       attr_accessor :progress, :message, :ids_retrieved
>
>       def do_work(args)
>         @progress = 0
>         @message = args[:message] || ""
>         @job_completed = false
>         @hse_notices_retrieved = 0
>         puts args[:message]
>         get_new_ids(args)
>       end
>
>       def get_new_ids(args)
>            ....
>       end
>     end|
>
> However, I get NoMethodError (undefined method `ids_retrieved' for
> #<ScrapeWorker:0x2a678b8>)
>
> Set up a quick unit test, and not surprisingly fails on first respond_to
>
>     |  def test_should_respond_to_progress_message_and_hse_notices_retrieved
>         MiddleMan.new_worker(:class => :scrape_worker, :args  =>
>     {:message => "Uh -Oh"}, :job_key => :test_scraper, :ttl => 5)
>         s = MiddleMan[:test_scraper]
>         assert s.respond_to?(:progress)
>         assert s.respond_to?(:message)
>         assert s.respond_to?(:hse_notices_retrieved)
>         assert_equal "Uh -Oh", s.message
>       end|
>
> I'm sure it must be something really obviously but can't for the life of
> me work out what. Any ideas?
>
> Thanks in advance
> Chris
>
> p.s. I'm on OS X, though not sure that's relevant here...
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>


-- 
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot hosting: www.slingshothosting.com


More information about the Backgroundrb-devel mailing list