Backgroundrb problem uninitialized constant BackgrounDRb::Me


#1

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?


#2

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.


#3

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?


#4

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})


#5

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.


#6

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


#7

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()


#8

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?


#9

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:inmethod_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


#10

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:indump_object’
vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:86:in
ask_work' vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:86:insend’
vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:86:in
invoke_on_connection' vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:inrun_method’
vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in
`method_missing’


#11

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:inmethod_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.


#12

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:inmethod_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?