[Backgroundrb-devel] Getting started

hemant kumar gethemant at gmail.com
Wed Feb 13 04:46:23 EST 2008


Hi,

On Tue, 2008-02-12 at 22:47 -0800, Richard Everhart wrote:
> On Feb 12, 2008 6:02 PM, hemant <gethemant at gmail.com> wrote:
> >
> > On Wed, Feb 13, 2008 at 7:19 AM, Richard Everhart
> > <rich.everhart at gmail.com> wrote:
> > >
> > > I upgraded ruby right before I wrote my original message and that was
> > >  causing some problems.  That's fixed but I still get the 'Not able to
> > >  connect' error.  In backgroundrb_server.log there seem to really be
> > >  two errors:
> > >
> > >  /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > >  `gem_original_require': no such file to load --  (LoadError)
> > >        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > >  `require'
> > >        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
> > >  `require'
> > >        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
> > >  `new_constants_in'
> > >        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
> > >  `require'
> > >        from /home/reverhart/drb_test/vendor/plugins/backgroundrb/framework/packet_master.rb:113:in
> > >  `start_worker'
> > >  [...snip...]
> > >  /home/reverhart/drb_test/vendor/plugins/backgroundrb/lib/../framework/nbio.rb:24:in
> > >  `read_data': Packet::DisconnectError (Packet::DisconnectError)
> > >        from /home/reverhart/drb_test/vendor/plugins/backgroundrb/framework/worker.rb:47:in
> > >  `handle_internal_messages'
> > >        from /home/reverhart/drb_test/vendor/plugins/backgroundrb/framework/core.rb:154:in
> > >  `start_reactor'
> > >  [...snip...]
> > >
> > >  The first error seems to be due to a ruby and/or rails configuration
> > >  error.  However, I've seen this error before, and the '--' in the
> > >  error message is usually followed by the name of the file that can't
> > >  be loaded.
> > >
> >
> > Did you define a worker before starting backgroundrb server? Above
> > error is because, bdrb is not able to load defined worker.
> > If you have the worker defined can we see the code of the worker.
> >
> 
> Here is my controller and worker:
> 
> class TestdrbController < ApplicationController
>   def do_fib
>     puts ">>> do_fib: #{params[:input]}"
> 
>     session[:job_key] = MiddleMan.new_worker(:class =>
> :fibonacci_worker, :data => params[:input])
> 
>     puts "Job key: #{session[:job_key]}"
> 
>     MiddleMan.send_request(:worker => :fibonacci_worker,
> :worker_method => :do_work, :data => params[:input])
> 
>     puts "<<< do_fib"
> 
>     render :action => 'result'
>   end
> 
>   def result
>     puts ">>> result"
>     MiddleMan.delete_worker(:worker => :fibonacci_worker, :job_key =>
> session[:job_key])
>     puts "<<< result"
>   end
> end

Although this is not related to your problem, but above controller code
has a bit of a problem, when you are not passing any job_key while
starting the worker via new_worker method, no job_key will be used and
while deleting the worker or invoking a task on the worker you should
not use job_key, if you haven't specified a job_key while creating the
worker.

> 
> class FibonacciWorker < BackgrounDRb::MetaWorker
>   include Fibonacci
> 
>   set_worker_name :fibonacci_worker
>   set_no_auto_load true
> 
>   def create(args = nil)
>     logger.info("Worker create: '#{args}'")
> 
>     register_status("Processing started")
> 
>     n = args.to_i
>     logger.info("Worker result: #{f(n)}")
>   end
> 
>   def do_work(data)
>     logger.info ">>> do_work"
> 
>     result = f(data.to_i)
>     logger.info "Worker result: #{result}"
> 
>     return result
>   end
> end

I took above worker code and created new rails application, checked out
bdrb code from trunk at devjavu and i was able to start bdrb without
problems. In a nutshell, I am unable to reproduce this problem. Now, can
you zip and send me your application through mail, so as I can see whats
wrong there?




More information about the Backgroundrb-devel mailing list