Forum: Ruby on Rails Backgroundrb problem uninitialized constant BackgrounDRb::Me

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Zhao Y. (Guest)
on 2009-01-12 05:28
I installed backgroundrb from http://svn.devjavu.com/backgroundrb/trunk
and there is no problem to start backgroundrb server. but when view the
page which controller requires the worker, I will get the error
"uninitialized constant BackgrounDRb::MetaWorker". Is this the problem
that I didn't require the class "MetaWorker" in my worker? How can I
require it?
Zhao Y. (Guest)
on 2009-01-14 08:49
Zhao Yi wrote:
> I installed backgroundrb from http://svn.devjavu.com/backgroundrb/trunk
> and there is no problem to start backgroundrb server. but when view the
> page which controller requires the worker, I will get the error
> "uninitialized constant BackgrounDRb::MetaWorker". Is this the problem
> that I didn't require the class "MetaWorker" in my worker? How can I
> require it?

Can anyone help me? I use Redhat9 OS and rails 2.1.2.

thanks.
Hemant K. (Guest)
on 2009-01-14 11:05
(Received via mailing list)
On Wed, Jan 14, 2009 at 12:19 PM, Zhao Yi
<removed_email_address@domain.invalid> wrote:
>
> Zhao Yi wrote:
>> I installed backgroundrb from http://svn.devjavu.com/backgroundrb/trunk
>> and there is no problem to start backgroundrb server. but when view the
>> page which controller requires the worker, I will get the error
>> "uninitialized constant BackgrounDRb::MetaWorker". Is this the problem
>> that I didn't require the class "MetaWorker" in my worker? How can I
>> require it?
>
> Can anyone help me? I use Redhat9 OS and rails 2.1.2.

There is something wrong with your setup. MetaWorker shouldn't be even
shown in controller/rails part of things.

Can you post your worker code and how are you invoke BackgrounDRb
worker tasks from rails?
Zhao Y. (Guest)
on 2009-01-14 11:09
Hemant K. wrote:
> There is something wrong with your setup. MetaWorker shouldn't be even
> shown in controller/rails part of things.
>
> Can you post your worker code and how are you invoke BackgrounDRb
> worker tasks from rails?

This is my worker definition. I use ruby script/generate worker MakeView
to generate this worker.

class MakeViewWorker < BackgrounDRb::MetaWorker
  set_worker_name :make_view_worker
  attr_reader :process
  def create(args)
    # this method is called, when worker is loaded for the first time
    process=0
    while process < 100
      sleep 1
      process = process+1
    end
  end
end

This is the code I used to invoke this worker.

 session[:make_view_job]=MiddleMan.new_worker(:class=>make_view_worker,
      :args=>{:product_name=>@project_name, :user_name=>@user_name,
              :version=>@project_version})
Hemant K. (Guest)
on 2009-01-14 13:48
(Received via mailing list)
On Wed, Jan 14, 2009 at 2:39 PM, Zhao Yi
<removed_email_address@domain.invalid> wrote:
>
>  end
> end
>
> This is the code I used to invoke this worker.
>
>  session[:make_view_job]=MiddleMan.new_worker(:class=>make_view_worker,
>      :args=>{:product_name=>@project_name, :user_name=>@user_name,
>              :version=>@project_version})


I have a feeling that you are mixing up syntax of BackgrounDRb across
its varied releases.

For example, syntax for creating new workers is:

http://backgroundrb.rubyforge.org/rails/#new_worker
Zhao Y. (Guest)
on 2009-01-15 04:50
I think this is because I didn't require the MetaWorker in my worker. Do
you know how to require this worker? I have tried "require
'backgroundrb'" but "no such file to load" error will be thrown.
Zhao Y. (Guest)
on 2009-01-15 05:23
I know what wrong. I should use this code:

used_job_key = MiddleMan.new_worker(:worker => :foo_worker,\
     :worker_key => "my_secret_job_key")

to get a worker. But after this, how can I invoke the worker with this
key?
Hemant K. (Guest)
on 2009-01-15 06:36
(Received via mailing list)
On Thu, Jan 15, 2009 at 8:53 AM, Zhao Yi
<removed_email_address@domain.invalid> wrote:
>
> I know what wrong. I should use this code:
>
> used_job_key = MiddleMan.new_worker(:worker => :foo_worker,\
>     :worker_key => "my_secret_job_key")
>
> to get a worker. But after this, how can I invoke the worker with this
> key?

examples are right there in the docs.  For example to invoke the worker:

MiddleMan.worker(:foo_worker,"my_secret_worker_key").async_do_foo()
Zhao Y. (Guest)
on 2009-01-15 07:14
> examples are right there in the docs.  For example to invoke the worker:
>
> MiddleMan.worker(:foo_worker,"my_secret_worker_key").async_do_foo()


thanks it works. but when I call this method I will get this error. I
have started backgroundrb server.

can't dump TCPSocket

vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:72:in
`dump'
vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:72:in
`dump_object'
vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:86:in
`ask_work'
vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:86:in
`send'
vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:86:in
`invoke_on_connection'
vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in
`run_method'
vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in
`method_missing'
Hemant K. (Guest)
on 2009-01-15 09:02
(Received via mailing list)
On Thu, Jan 15, 2009 at 10:44 AM, Zhao Yi
<removed_email_address@domain.invalid> wrote:
>
> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in
> `run_method'
> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in
> `method_missing'

Please read the API docs carefully, rather than getting spoon fed here
on the list. These things are clearly mentioned on
http://backgroundrb.rubyforge.org
Zhao Y. (Guest)
on 2009-01-15 09:13
Hemant K. wrote:
> On Thu, Jan 15, 2009 at 10:44 AM, Zhao Yi
> <removed_email_address@domain.invalid> wrote:
>>
>> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in
>> `run_method'
>> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in
>> `method_missing'
>
> Please read the API docs carefully, rather than getting spoon fed here
> on the list. These things are clearly mentioned on
> http://backgroundrb.rubyforge.org

Hi,

I have followed this instruction and there isn't anything related with
TCP or dump.
Zhao Y. (Guest)
on 2009-01-15 10:13
Hemant K. wrote:
> On Thu, Jan 15, 2009 at 10:44 AM, Zhao Yi
> <removed_email_address@domain.invalid> wrote:
>>
>> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in
>> `run_method'
>> vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in
>> `method_missing'
>
> Please read the API docs carefully, rather than getting spoon fed here
> on the list. These things are clearly mentioned on
> http://backgroundrb.rubyforge.org

I set the config/backgroundrb.yml. If the :ip: refers to 0.0.0.0, I will
get the error of can't dump TCPSocket. If the :ip: refers to the
machine's IP, I will get No BackgrounDRb server is found running error.
How can I set the IP to avoid this error?
This topic is locked and can not be replied to.