Hi, Is it possible to start a worker with job_key and then ask_status of that specific worker with the job_key? MiddleMan.ask_work(:worker => :auth_worker, :job_key=>''1'', :worker_method => :auth) and then MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'')>From my testing of the new backgroundrb, asking status using job key alwaysreturn blank. Is it possible to do this? thanks, - reynard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20071218/bc2f7038/attachment.html
Ivan S. Manida
2007-Dec-18 16:50 UTC
[Backgroundrb-devel] querying status of worker with job_key
Reynard wrote:> Is it possible to start a worker with job_key and then ask_statusof that> specific worker with the job_key? > > MiddleMan.ask_work(:worker => :auth_worker, :job_key=>''1'', > :worker_method => :auth) > > and then > > MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'')You should use register_status() from your worker - this works for me (using job_key as you describe). Of course, code is not yet well tested, but at least the status part is working fine :) I have another problem - meta_pimp dies sometimes, in about 50% of the jobs. With the following stack trace. Worker is trivial but is using job_key. Looking through the code, it seems that connection is dropped while working, but which one - master <-> worker? /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:58:in `process_response'': undefined method `instance'' for nil:NilClass (NoMethodError) from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:29:in `handle_object'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:20:in `receive_data'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/lib/../framework/bin_parser.rb:29:in `call'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/lib/../framework/bin_parser.rb:29:in `extract'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/lib/../framework/bin_parser.rb:42:in `extract'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:18:in `receive_data'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/packet_master.rb:63:in `handle_internal_messages'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:154:in `start_reactor'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:152:in `each'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:152:in `start_reactor'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:143:in `loop'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:143:in `start_reactor'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/packet_master.rb:20:in `run'' from /var/apps/ror_trunk/vendor/plugins/backgroundrb/server/master_worker.rb:133:in `initialize'' from script/backgroundrb:37:in `new'' from script/backgroundrb:37 Some read error Some read error Some read error Some read error Some read error Some read error Some read error Some read error Some read error Some read error Some read error Some read error Some read error
> You should use register_status() from your worker - this works for > me (using job_key as you describe). Of course, code is not yet well > tested, but at least the status part is working fine :) >I did register the status from the worker just like this register_status(''success'') do you have to pass the job key again when registering the status? and how do you ask_status for that job_key? is this the right way? MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'') anyway, everytime I call ask_status with job_key it returns nil, If I don''t pass the job_key it returns something (which is the default process I think) - reynard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20071218/a666be2b/attachment.html
hemant kumar
2007-Dec-18 17:12 UTC
[Backgroundrb-devel] querying status of worker with job_key
On Tue, 2007-12-18 at 19:50 +0300, Ivan S. Manida wrote:> Reynard wrote: > > Is it possible to start a worker with job_key and then ask_status > of that > > specific worker with the job_key? > > > > MiddleMan.ask_work(:worker => :auth_worker, :job_key=>''1'', > > :worker_method => :auth) > > > > and then > > > > MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'') > > > You should use register_status() from your worker - this works for > me (using job_key as you describe). Of course, code is not yet well > tested, but at least the status part is working fine :)yes thats correct, before being able to query status of a worker, you need to set the status object first and it will work afterwards. For example: class ErrorWorker < BackgrounDRb::MetaWorker set_worker_name :error_worker set_no_auto_load(true) def create(args = nil) logger.info "login worker started" register_status("Started") end end>> MiddleMan.new_worker(:worker => :error_worker, :job_key => "hello")=> 71>> MiddleMan.ask_status(:worker => :error_worker, :job_key => "hello")=> "Started"> > I have another problem - meta_pimp dies sometimes, in about 50% of > the jobs. With the following stack trace. Worker is trivial but is > using job_key. Looking through the code, it seems that connection is > dropped while working, but which one - master <-> worker? > > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:58:in > `process_response'': undefined method `instance'' for nil:NilClass > (NoMethodError) > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:29:in > `handle_object'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:20:in > `receive_data'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/lib/../framework/bin_parser.rb:29:in > `call'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/lib/../framework/bin_parser.rb:29:in > `extract'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/lib/../framework/bin_parser.rb:42:in > `extract'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/meta_pimp.rb:18:in > `receive_data'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/packet_master.rb:63:in > `handle_internal_messages'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:154:in > `start_reactor'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:152:in > `each'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:152:in > `start_reactor'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:143:in > `loop'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/core.rb:143:in > `start_reactor'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/framework/packet_master.rb:20:in > `run'' > from > /var/apps/ror_trunk/vendor/plugins/backgroundrb/server/master_worker.rb:133:in > `initialize'' > from script/backgroundrb:37:in `new'' > from script/backgroundrb:37 > Some read errorOk Ivan, This is happening because, bdrb worker is trying to send data to rails, even when rails has disconncted. It should be fixed now. Check it out. -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org
hemant kumar
2007-Dec-18 17:20 UTC
[Backgroundrb-devel] querying status of worker with job_key
On Tue, 2007-12-18 at 12:10 -0500, Reynard wrote:> > You should use register_status() from your worker - this works > for > me (using job_key as you describe). Of course, code is not yet > well > tested, but at least the status part is working fine :) > > I did register the status from the worker just like this > > register_status(''success'') > > do you have to pass the job key again when registering the status? > > and how do you ask_status for that job_key? is this the right way? > > MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'') > > anyway, everytime I call ask_status with job_key it returns nil, If I > don''t pass the job_key it returns something (which is the default > process I think)Sync with upto the minute latest code of backgroundrb. paste your worker code. What you are doing, seem to be correct. I would like to see, what can go wrong. -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org
Ivan S. Manida
2007-Dec-18 17:25 UTC
[Backgroundrb-devel] querying status of worker with job_key
Reynard wrote:> I did register the status from the worker just like this > > register_status(''success'') > > do you have to pass the job key again when registering the status? > > and how do you ask_status for that job_key? is this the right way? > > MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'') >That seems right. I suspect you don''t do a MiddleMan.new_worker(:worker => :auth_worker, :job_key=>''1'') which would be needed to create a separate worker instance with your job_key.